18#define TARGET_OS_MAC true
31#include <MacWindows.h>
63 int CKLoop(
int waitTime = 60);
74 CKWindow*
CKNewMsgBoxPlain(
const char*
message,
const char* title =
nullptr,
const char* btnOk =
"OK",
const char* btnCancel =
nullptr, std::function<
void(
int button)> callback = 0);
75 CKWindow*
CKNewMsgBoxNote(
const char*
message,
const char* title =
nullptr,
const char* btnOk =
"OK",
const char* btnCancel =
nullptr, std::function<
void(
int button)> callback = 0);
76 CKWindow*
CKNewMsgBoxWarning(
const char*
message,
const char* title =
nullptr,
const char* btnOk =
"OK",
const char* btnCancel =
"Cancel", std::function<
void(
int button)> callback = 0);
77 CKWindow*
CKNewMsgBoxError(
const char*
message,
const char* title =
nullptr,
const char* btnOk =
"OK",
const char* btnCancel =
"Cancel", std::function<
void(
int button)> callback = 0);
93 void __DoHousekeepingTasks();
94 void __DispatchEvent(EventRecord event);
95 inline void __HandleEvtKey(EventRecord event,
bool isKeyUp,
bool isAutoKey);
96 inline void __HandleEvtMouseDown(EventRecord event);
97 inline void __HandleEvtMouseUp(EventRecord event);
98 inline void __HandleEvtMouseMove(EventRecord event);
99 inline void __HandleEvtUpdate(EventRecord event);
100 inline void __HandleEvtActivate(EventRecord event);
101 inline void __HandleEvtOS(EventRecord event);
102 void __HandleMenuPropertyChange(
const CKObject* obj,
const char* propName);
103 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);
108 std::vector<CKWindow*> __windows;
109 std::vector<CKWindow*> __gc_windows;
110 std::vector<CKTimer*> __timers;
114 std::vector<CKNetBaseSocket*> __net_sockets;
Defines the main entry point for a Clapkit application.
Definition ckApp.h:57
void CKRemoveTimer(CKTimer *timer)
Stop and remove timer.
Definition ckApp.cpp:964
~CKApp()
Definition ckApp.cpp:68
void CKQuit()
Definition ckApp.cpp:142
void CKAddTimer(CKTimer *timer, CKObject *owner=nullptr)
Add a new timer to the app, enabling (via Start) as you add it.
Definition ckApp.cpp:953
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:184
void CKIncreaseWork()
Show the 'Working' cursor.
Definition ckApp.cpp:421
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:285
CKWindow * CKTopMostWindow()
Return the top-most window we have.
Definition ckApp.cpp:468
void CKDecreaseWork()
Decrease work count by one, if zero, hide the 'Working' cursor.
Definition ckApp.cpp:430
int CKLoop(int waitTime=60)
Main event loop, handling events. Needs to be called as much as possible.
Definition ckApp.cpp:77
CKWindow * CKFindWindow(CKWindowPtr ptr)
Try to find a window by the WindowPtr. Probably only applies to Toolbox Mac.
Definition ckApp.cpp:207
void CKShowMenuBar()
If hidden, bring the menu bar back.
Definition ckApp.cpp:1091
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:1120
void CKRemoveWindow(CKWindow *window)
Remove and destroy window. You MUST use this function instead of deleting a window yourself.
Definition ckApp.cpp:231
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:266
CKError CKSetMenu(CKMenuBar *menu)
Set the application's menu bar.
Definition ckApp.cpp:1007
void CKHideMenuBar()
If shown, hide the menu bar.
Definition ckApp.cpp:1098
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:323
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:304
void CKRemoveTimersOfOwner(CKObject *owner)
Remove all timers of a specific owner.
Definition ckApp.cpp:981
void CKRestoreCursor()
Changed the cursor yourself? Call this to get the default/waiting back.
Definition ckApp.cpp:444
short CKFontToId(const char *font)
Convert a font name to a font Id.
Definition ckApp.cpp:933
Defines the base of all TCP client/server sockets.
Definition ckNetBaseSocket.h:41
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:89
int32_t CKError
Return type for functions that might return an error. Also see: CKPass and CKErrorCode.
Definition ckTypes.h:26
CKSystemIcon
Defines a system icon type.
Definition ckTypes.h:524
Initialization parameters for a CKWindow.
Definition ckWindow.h:44