94 CKColor(u_int8_t red, u_int8_t green, u_int8_t blue)
95 :
r(red),
g(green),
b(blue) {};
102 toReturn.red =
r * 255;
103 toReturn.green =
g * 255;
104 toReturn.blue =
b * 255;
109 return r == other.
r &&
g == other.
g &&
b == other.
b;
113 return !(*
this == other);
146 Point* p = (Point*)
CKMalloc(
sizeof(*p));
161 return this->x == other.
x && this->y == other.
y;
165 return !(*
this == other);
203 toReturn.
width = p.h;
209 return this->width == other.
width && this->height == other.
height;
213 return !(*
this == other);
245 this->size =
CKSize(w, h);
250 this->size =
CKSize(w, h);
263 r.left = this->origin->x;
264 r.right = this->origin->x + this->size->width;
265 r.top = this->origin->y;
266 r.bottom = this->origin->y + this->size->height;
274 Rect* toReturn = (Rect*)
CKMalloc((
sizeof(*toReturn)));
275 toReturn->left = this->origin->x;
276 toReturn->right = this->origin->x + this->size->width;
277 toReturn->top = this->origin->y;
278 toReturn->bottom = this->origin->y + this->size->height;
288 toReturn.
size =
CKSize(r.right - r.left, r.bottom - r.top);
296 if (p.
x >= this->origin->x && p.
x <= this->origin->x + this->size->width) {
297 if (p.
y >= this->origin->y && p.
y <= this->origin->y + this->size->height) {
319 return !(*
this == other);
521 shiftDown = (e.modifiers & shiftKey) == shiftKey;
522 cmdDown = (e.modifiers & cmdKey) == cmdKey;
523 optDown = (e.modifiers & optionKey) == optionKey;
524 ctrlDown = (e.modifiers & controlKey) == controlKey;
Defines the base of all UI Controls.
Definition ckControl.h:89
const char * what()
Definition ckTypes.h:43
const char * message
Definition ckTypes.h:40
CKException(const char *msg)
Definition ckTypes.h:41
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:91
#define CKMalloc(sz)
Use instead of malloc.
Definition ckMemory.h:54
CKControlType
Defines a control type (i.e. PushButton, Checkbox, etc.)
Definition ckTypes.h:52
CKTextJustification
Used for text labels, etc.
Definition ckTypes.h:78
CKEventType
Defines an event type for controls (and windows.)
Definition ckTypes.h:335
CKScrollType
Defines a scroll type.
Definition ckTypes.h:543
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
CKMouseButton
Abstraction for mouse buttons.
Definition ckTypes.h:67
@ 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.
@ tcpError
TCP socket has an error.
@ 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:88
u_int8_t b
Definition ckTypes.h:91
CKColor()
Definition ckTypes.h:97
RGBColor ToOS()
Definition ckTypes.h:100
bool operator!=(const CKColor &other) const
Definition ckTypes.h:112
u_int8_t r
Definition ckTypes.h:89
bool operator==(const CKColor &other) const
Definition ckTypes.h:108
CKColor(u_int8_t red, u_int8_t green, u_int8_t blue)
Definition ckTypes.h:94
u_int8_t a
Definition ckTypes.h:92
u_int8_t g
Definition ckTypes.h:90
Defines an event raised by the framework, mostly for user actions.
Definition ckTypes.h:496
CKEvent(CKEventType type, CKPoint point)
Definition ckTypes.h:517
CKError errCode
Definition ckTypes.h:513
const CKWindow * window
Definition ckTypes.h:510
bool cmdDown
Definition ckTypes.h:503
CKPoint point
Definition ckTypes.h:499
char character
Definition ckTypes.h:508
void fillFromOS(EventRecord e)
Definition ckTypes.h:520
CKEvent(CKEventType type)
Definition ckTypes.h:515
const CKControl * control
Definition ckTypes.h:511
CKEventType type
Definition ckTypes.h:498
bool shiftDown
Definition ckTypes.h:502
char key
Definition ckTypes.h:507
CKMouseButton mouseButton
Definition ckTypes.h:500
bool optDown
Definition ckTypes.h:504
bool ctrlDown
Definition ckTypes.h:505
Defines a point on the screen.
Definition ckTypes.h:122
bool operator!=(const CKPoint &other) const
Definition ckTypes.h:164
void Subscribe(std::function< void()> cb)
Definition ckTypes.h:169
CKPoint(int x, int y)
Definition ckTypes.h:127
CKProperty< int > x
Definition ckTypes.h:124
CKProperty< int > y
Definition ckTypes.h:125
Point * ToOSPtr()
Definition ckTypes.h:145
bool operator==(const CKPoint &other) const
Definition ckTypes.h:160
static CKPoint FromOS(Point p)
Definition ckTypes.h:155
Point ToOS() const
Definition ckTypes.h:135
CKPoint()
Definition ckTypes.h:129
Defines a rectangular area at a specific location.
Definition ckTypes.h:228
bool operator==(const CKRect &other) const
Definition ckTypes.h:311
void Subscribe(std::function< void()> cb)
Definition ckTypes.h:323
CKRect(int x, int y, int w, int h)
Definition ckTypes.h:243
CKProperty< CKPoint > origin
Definition ckTypes.h:230
bool IntersectsPoint(CKPoint p)
Definition ckTypes.h:295
CKProperty< CKSize > size
Definition ckTypes.h:231
Rect * ToOSCopy()
Definition ckTypes.h:273
bool IntersectsRect(CKRect r)
Definition ckTypes.h:304
Rect ToOS() const
Definition ckTypes.h:261
CKRect(CKPoint o, CKSize s)
Definition ckTypes.h:238
bool operator!=(const CKRect &other) const
Definition ckTypes.h:318
CKRect(const CKRect &f)
Definition ckTypes.h:233
static CKRect FromOS(Rect r)
Definition ckTypes.h:285
CKRect(int w, int h)
Definition ckTypes.h:248
CKRect()
Definition ckTypes.h:253
Defines a rectangular area.
Definition ckTypes.h:180
bool operator!=(const CKSize &other) const
Definition ckTypes.h:212
CKProperty< int > width
Definition ckTypes.h:182
Point ToOS() const
Definition ckTypes.h:191
CKProperty< int > height
Definition ckTypes.h:183
void Subscribe(std::function< void()> cb)
Definition ckTypes.h:217
static CKSize FromOS(Point p)
Definition ckTypes.h:201
CKSize(int w, int h)
Definition ckTypes.h:185
CKSize()
Definition ckTypes.h:188
bool operator==(const CKSize &other) const
Definition ckTypes.h:208