18#define TARGET_OS_MAC true
31#include <MacWindows.h>
64 int CKLoop(
int waitTime = 60);
75 CKWindow*
CKNewMsgBoxPlain(
const char*
message,
const char* title =
nullptr,
const char* btnOk =
"OK",
const char* btnCancel =
nullptr, std::function<
void(
int button)> callback = 0);
76 CKWindow*
CKNewMsgBoxNote(
const char*
message,
const char* title =
nullptr,
const char* btnOk =
"OK",
const char* btnCancel =
nullptr, std::function<
void(
int button)> callback = 0);
77 CKWindow*
CKNewMsgBoxWarning(
const char*
message,
const char* title =
nullptr,
const char* btnOk =
"OK",
const char* btnCancel =
"Cancel", std::function<
void(
int button)> callback = 0);
78 CKWindow*
CKNewMsgBoxError(
const char*
message,
const char* title =
nullptr,
const char* btnOk =
"OK",
const char* btnCancel =
"Cancel", std::function<
void(
int button)> callback = 0);
94 void __DoHousekeepingTasks();
95 void __DispatchEvent(EventRecord event);
96 inline void __HandleEvtKey(EventRecord event,
bool isKeyUp,
bool isAutoKey);
97 inline void __HandleEvtMouseDown(EventRecord event);
98 inline void __HandleEvtMouseUp(EventRecord event);
99 inline void __HandleEvtMouseMove(EventRecord event);
100 inline void __HandleEvtUpdate(EventRecord event);
101 inline void __HandleEvtActivate(EventRecord event);
102 inline void __HandleEvtOS(EventRecord event);
103 void __HandleMenuPropertyChange(
const CKObject* obj,
const char* propName);
104 CKWindow* __CreateAlertDialog(
const char* title,
const char*
message,
const CKSystemIcon icon,
const char* btnOk =
"OK",
const char* btnCancel = 0, std::function<
void(
int button)> callback = 0);
109 std::vector<CKWindow*> __windows;
110 std::vector<CKWindow*> __gc_windows;
111 std::vector<CKTimer*> __timers;
115 std::vector<CKNetBaseSocket*> __net_sockets;
Defines the main entry point for a Clapkit application.
Definition ckApp.h:58
void CKRemoveTimer(CKTimer *timer)
Stop and remove timer.
Definition ckApp.cpp:1003
~CKApp()
Definition ckApp.cpp:70
void CKQuit()
Definition ckApp.cpp:178
void CKAddTimer(CKTimer *timer, CKObject *owner=nullptr)
Add a new timer to the app, enabling (via Start) as you add it.
Definition ckApp.cpp:992
CKWindow * CKNewWindow(const CKWindowInitParams ¶ms)
Create a new window and if successful, add it to the list of the windows the app has....
Definition ckApp.cpp:220
void CKIncreaseWork()
Show the 'Working' cursor.
Definition ckApp.cpp:458
CKWindow * CKNewMsgBoxPlain(const char *message, const char *title=nullptr, const char *btnOk="OK", const char *btnCancel=nullptr, std::function< void(int button)> callback=0)
Create and show an alert. Alerts are non-blocking. btnCancel is optional and only shown if set to a n...
Definition ckApp.cpp:321
CKWindow * CKTopMostWindow()
Return the top-most window we have.
Definition ckApp.cpp:505
void CKDecreaseWork()
Decrease work count by one, if zero, hide the 'Working' cursor.
Definition ckApp.cpp:467
int CKLoop(int waitTime=60)
Main event loop, handling events. Needs to be called as much as possible.
Definition ckApp.cpp:113
CKWindow * CKFindWindow(CKWindowPtr ptr)
Try to find a window by the WindowPtr. Probably only applies to Toolbox Mac.
Definition ckApp.cpp:243
void CKShowMenuBar()
If hidden, bring the menu bar back.
Definition ckApp.cpp:1130
CKApp()
The starting point of any Clapkit app. Initialize the app, set up menus, etc.
Definition ckApp.cpp:35
void CKUpdateMenuBarItems()
Called from CKWindow on focused-item change to update (i.e. enable/disable) the standard menu items (...
Definition ckApp.cpp:1159
void CKRemoveWindow(CKWindow *window)
Remove and destroy window. You MUST use this function instead of deleting a window yourself.
Definition ckApp.cpp:267
CKWindow * CKNewMsgBoxNote(const char *message, const char *title=nullptr, const char *btnOk="OK", const char *btnCancel=nullptr, std::function< void(int button)> callback=0)
Create and show an alert. Alerts are non-blocking. btnCancel is optional and only shown if set to a n...
Definition ckApp.cpp:302
CKError CKSetMenu(CKMenuBar *menu)
Set the application's menu bar.
Definition ckApp.cpp:1046
void CKHideMenuBar()
If shown, hide the menu bar.
Definition ckApp.cpp:1137
CKWindow * CKNewMsgBoxError(const char *message, const char *title=nullptr, const char *btnOk="OK", const char *btnCancel="Cancel", std::function< void(int button)> callback=0)
Create and show an alert. Alerts are non-blocking. btnCancel is optional and only shown if set to a n...
Definition ckApp.cpp:359
CKWindow * CKNewMsgBoxWarning(const char *message, const char *title=nullptr, const char *btnOk="OK", const char *btnCancel="Cancel", std::function< void(int button)> callback=0)
Create and show an alert. Alerts are non-blocking. btnCancel is optional and only shown if set to a n...
Definition ckApp.cpp:340
void CKRemoveTimersOfOwner(CKObject *owner)
Remove all timers of a specific owner.
Definition ckApp.cpp:1020
void CKRestoreCursor()
Changed the cursor yourself? Call this to get the default/waiting back.
Definition ckApp.cpp:481
short CKFontToId(const char *font)
Convert a font name to a font Id.
Definition ckApp.cpp:972
Defines the base of all TCP client/server sockets.
Definition ckNetBaseSocket.h:53
Defines the base class for all controls and objects.
Definition ckObject.h:43
Defines a timer that can execute code on a pre-defined interval.
Definition ckTimer.h:27
Defines a window. Window type (modal, document) is determined by CKWindowInitParams and CKWindowType.
Definition ckWindow.h:91
int32_t CKError
Return type for functions that might return an error. Also see: CKPass and CKErrorCode.
Definition ckTypes.h:27
CKSystemIcon
Defines a system icon type.
Definition ckTypes.h:532
Initialization parameters for a CKWindow.
Definition ckWindow.h:46