93 CKColor(u_int8_t red, u_int8_t green, u_int8_t blue)
94 :
r(red),
g(green),
b(blue) {};
101 toReturn.red =
r * 255;
102 toReturn.green =
g * 255;
103 toReturn.blue =
b * 255;
108 return r == other.
r &&
g == other.
g &&
b == other.
b;
112 return !(*
this == other);
145 Point* p = (Point*)
CKMalloc(
sizeof(*p));
160 return this->x == other.
x && this->y == other.
y;
164 return !(*
this == other);
202 toReturn.
width = p.h;
208 return this->width == other.
width && this->height == other.
height;
212 return !(*
this == other);
244 this->size =
CKSize(w, h);
249 this->size =
CKSize(w, h);
262 r.left = this->origin->x;
263 r.right = this->origin->x + this->size->width;
264 r.top = this->origin->y;
265 r.bottom = this->origin->y + this->size->height;
273 Rect* toReturn = (Rect*)
CKMalloc((
sizeof(*toReturn)));
274 toReturn->left = this->origin->x;
275 toReturn->right = this->origin->x + this->size->width;
276 toReturn->top = this->origin->y;
277 toReturn->bottom = this->origin->y + this->size->height;
287 toReturn.
size =
CKSize(r.right - r.left, r.bottom - r.top);
295 if (p.
x >= this->origin->x && p.
x <= this->origin->x + this->size->width) {
296 if (p.
y >= this->origin->y && p.
y <= this->origin->y + this->size->height) {
318 return !(*
this == other);
513 shiftDown = (e.modifiers & shiftKey) == shiftKey;
514 cmdDown = (e.modifiers & cmdKey) == cmdKey;
515 optDown = (e.modifiers & optionKey) == optionKey;
516 ctrlDown = (e.modifiers & controlKey) == controlKey;
Defines the base of all UI Controls.
Definition ckControl.h:89
const char * what()
Definition ckTypes.h:42
const char * message
Definition ckTypes.h:39
CKException(const char *msg)
Definition ckTypes.h:40
Defines an observable value.
Definition ckProperty.h:60
const T & get() const
Definition ckProperty.h:68
std::function< void()> onChange
The function to be called when the value changes.
Definition ckProperty.h:169
Defines a window. Window type (modal, document) is determined by CKWindowInitParams and CKWindowType.
Definition ckWindow.h:89
#define CKMalloc(sz)
Use instead of malloc.
Definition ckMemory.h:54
CKControlType
Defines a control type (i.e. PushButton, Checkbox, etc.)
Definition ckTypes.h:51
CKTextJustification
Used for text labels, etc.
Definition ckTypes.h:77
CKEventType
Defines an event type for controls (and windows.)
Definition ckTypes.h:334
CKScrollType
Defines a scroll type.
Definition ckTypes.h:535
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
CKMouseButton
Abstraction for mouse buttons.
Definition ckTypes.h:66
@ moved
(Window-only) Window has moved.
@ tcpDisconnected
TCP socket has disconnected.
@ keyDown
Keyboard key pressed.
@ dataPaste
User wants to perform a paste (Cmd + V) If no such event handler is installed, Clapkit will try to pe...
@ tcpConnectionFailed
TCP socket was unable to connect to the specified address.
@ mouseUp
Mouse button released.
@ dataCopy
User wants to perform a copy (Cmd + C) If no such event handler is installed, Clapkit will try to per...
@ resized
(Window-only) Window has been resized.
@ mouseDown
Mouse button pressed down on window or control.
@ changed
For textfields, etc where value can be changed.
@ dataClear
User wants to perform a 'clear' - i.e. delete all data on an user-editable control....
@ tcpBufferFull
TCP socket's incoming data buffer became full and you've missed incoming data - and will be missing d...
@ dataCut
User wants to perform a cut (Cmd + X) If no such event handler is installed, Clapkit will try to perf...
@ click
User clicked on window/control.
@ removed
Window has been closed or control removed from window.
@ doubleClick
User double-clicked on window/control.
@ mouseMove
Mouse is being dragged while clicking.
@ tcpReceivedData
TCP socket has data to read.
@ deleted
Window or control has been deleted/released.
@ keyUp
Keyboard key released.
@ tcpConnected
TCP socket has connected.
@ dataUndo
User wants to perform an undo (Cmd + Z) If no such event handler is installed, Clapkit will try to pe...
Defines an RGB color. A (Alpha) is usually not used in our case.
Definition ckTypes.h:87
u_int8_t b
Definition ckTypes.h:90
CKColor()
Definition ckTypes.h:96
RGBColor ToOS()
Definition ckTypes.h:99
bool operator!=(const CKColor &other) const
Definition ckTypes.h:111
u_int8_t r
Definition ckTypes.h:88
bool operator==(const CKColor &other) const
Definition ckTypes.h:107
CKColor(u_int8_t red, u_int8_t green, u_int8_t blue)
Definition ckTypes.h:93
u_int8_t a
Definition ckTypes.h:91
u_int8_t g
Definition ckTypes.h:89
Defines an event raised by the framework, mostly for user actions.
Definition ckTypes.h:490
CKEvent(CKEventType type, CKPoint point)
Definition ckTypes.h:509
const CKWindow * window
Definition ckTypes.h:504
bool cmdDown
Definition ckTypes.h:497
CKPoint point
Definition ckTypes.h:493
char character
Definition ckTypes.h:502
void fillFromOS(EventRecord e)
Definition ckTypes.h:512
CKEvent(CKEventType type)
Definition ckTypes.h:507
const CKControl * control
Definition ckTypes.h:505
CKEventType type
Definition ckTypes.h:492
bool shiftDown
Definition ckTypes.h:496
char key
Definition ckTypes.h:501
CKMouseButton mouseButton
Definition ckTypes.h:494
bool optDown
Definition ckTypes.h:498
bool ctrlDown
Definition ckTypes.h:499
Defines a point on the screen.
Definition ckTypes.h:121
bool operator!=(const CKPoint &other) const
Definition ckTypes.h:163
void Subscribe(std::function< void()> cb)
Definition ckTypes.h:168
CKPoint(int x, int y)
Definition ckTypes.h:126
CKProperty< int > x
Definition ckTypes.h:123
CKProperty< int > y
Definition ckTypes.h:124
Point * ToOSPtr()
Definition ckTypes.h:144
bool operator==(const CKPoint &other) const
Definition ckTypes.h:159
static CKPoint FromOS(Point p)
Definition ckTypes.h:154
Point ToOS() const
Definition ckTypes.h:134
CKPoint()
Definition ckTypes.h:128
Defines a rectangular area at a specific location.
Definition ckTypes.h:227
bool operator==(const CKRect &other) const
Definition ckTypes.h:310
void Subscribe(std::function< void()> cb)
Definition ckTypes.h:322
CKRect(int x, int y, int w, int h)
Definition ckTypes.h:242
CKProperty< CKPoint > origin
Definition ckTypes.h:229
bool IntersectsPoint(CKPoint p)
Definition ckTypes.h:294
CKProperty< CKSize > size
Definition ckTypes.h:230
Rect * ToOSCopy()
Definition ckTypes.h:272
bool IntersectsRect(CKRect r)
Definition ckTypes.h:303
Rect ToOS() const
Definition ckTypes.h:260
CKRect(CKPoint o, CKSize s)
Definition ckTypes.h:237
bool operator!=(const CKRect &other) const
Definition ckTypes.h:317
CKRect(const CKRect &f)
Definition ckTypes.h:232
static CKRect FromOS(Rect r)
Definition ckTypes.h:284
CKRect(int w, int h)
Definition ckTypes.h:247
CKRect()
Definition ckTypes.h:252
Defines a rectangular area.
Definition ckTypes.h:179
bool operator!=(const CKSize &other) const
Definition ckTypes.h:211
CKProperty< int > width
Definition ckTypes.h:181
Point ToOS() const
Definition ckTypes.h:190
CKProperty< int > height
Definition ckTypes.h:182
void Subscribe(std::function< void()> cb)
Definition ckTypes.h:216
static CKSize FromOS(Point p)
Definition ckTypes.h:200
CKSize(int w, int h)
Definition ckTypes.h:184
CKSize()
Definition ckTypes.h:187
bool operator==(const CKSize &other) const
Definition ckTypes.h:207