19#include <MacWindows.h>
113 const std::vector<CKControl*>&
GetControls()
const;
122 template <
typename T>
126 out.reserve(__controls.size());
127 for (
auto* c : __controls) {
128 if (
auto* t =
dynamic_cast<T*
>(c)) {
151 void __InvalidateEntireWindow();
179 std::vector<CKControl*> __controls;
181 CKControl* __activeTextInputControl =
nullptr;
184 bool __isCurrentlyActive =
false;
186 std::vector<CKRect> __controlDirtifiedAreas;
Defines the main entry point for a Clapkit application.
Definition ckApp.h:57
Defines the base of all UI Controls.
Definition ckControl.h:89
A base for controls that can have a "focus" - i.e. textfields.
Definition ck_pFocusableControl.h:22
Defines the base class for all controls and objects.
Definition ckObject.h:43
Defines an observable value.
Definition ckProperty.h:60
Defines a window. Window type (modal, document) is determined by CKWindowInitParams and CKWindowType.
Definition ckWindow.h:89
const CKWindowPtr GetWindowPtr() const
Definition ckWindow.cpp:501
void RemoveControl(CKControl *control, bool free)
Definition ckWindow.cpp:253
const std::vector< CKControl * > & GetControls() const
Get the list of controls in this window.
Definition ckWindow.cpp:402
void Center()
Definition ckWindow.cpp:185
bool AddControl(CKControl *control)
Definition ckWindow.cpp:216
CKProperty< CKRect > rect
Definition ckWindow.h:160
CKControl * GetLastControl() const
Definition ckWindow.cpp:491
CKProperty< CKColor > backgroundColor
Definition ckWindow.h:163
bool shouldReceiveMouseMoveEvents
True if we should receive mouseMove events. We are storing this as a hack to speed things up as HasHa...
Definition ckWindow.h:175
void SetIsActive(bool active)
Definition ckWindow.cpp:468
CKProperty< bool > visible
Definition ckWindow.h:161
void DirtyArea(const CKRect r)
Definition ckWindow.cpp:511
int minimumHeight
Definition ckWindow.h:167
CKProperty< bool > hasCustomBackgroundColor
Definition ckWindow.h:162
void SetLastControl(CKControl *control)
Definition ckWindow.cpp:496
void Redraw(CKRect rectToRedraw)
Definition ckWindow.cpp:289
int minimumWidth
Definition ckWindow.h:166
bool GetIsActive()
Definition ckWindow.cpp:506
void SetTitle(const char *title)
Definition ckWindow.cpp:125
CKProperty< bool > closable
Definition ckWindow.h:164
CKApp * GetOwner()
Return the app this window is a part of.
Definition ckWindow.cpp:366
virtual ~CKWindow()
Definition ckWindow.cpp:93
void __ReflectToOS()
Definition ckWindow.cpp:570
char * GetTitle()
Definition ckWindow.cpp:137
int maximumHeight
Definition ckWindow.h:169
virtual void RaisePropertyChange(const char *propertyName)
Definition ckWindow.cpp:592
void Show()
Definition ckWindow.cpp:152
void Close()
Definition ckWindow.cpp:197
virtual bool HandleEvent(const CKEvent &evt)
Definition ckWindow.cpp:529
CKControl * FindControl(CKPoint point)
Definition ckWindow.cpp:379
void Loop()
Called from CKApp to do stuff like blinking the caret, etc.
Definition ckWindow.cpp:113
void Focus()
Make the window foremost window. Make visible if invisible.
Definition ckWindow.cpp:174
std::vector< T * > GetControlsOfType() const
Get the list of controls of type T in this window.
Definition ckWindow.h:123
void SetOwner(CKApp *owner)
Definition ckWindow.cpp:358
void SetActiveControl(CKControl *control)
Called by ckApp on a click event - to set the active control (like a textfield.)
Definition ckWindow.cpp:440
bool ContainsControl(CKControl *control)
Definition ckWindow.cpp:409
void Hide()
Definition ckWindow.cpp:164
int maximumWidth
Definition ckWindow.h:168
CKFocusableControl * GetActiveControl()
Called by ckApp to determine UI Changes needed, like enabling/disabling menu items.
Definition ckWindow.cpp:427
#define CKSafeCopyString(dest, src)
Copy a string (if it is a string) to a destination. Free the destination if there is already somethin...
Definition ckMemory.h:93
CKWindowType
Defines the type of the window.
Definition ckWindow.h:27
Defines an RGB color. A (Alpha) is usually not used in our case.
Definition ckTypes.h:87
Defines an event raised by the framework, mostly for user actions.
Definition ckTypes.h:490
Defines a point on the screen.
Definition ckTypes.h:121
Defines a rectangular area at a specific location.
Definition ckTypes.h:227
Defines a rectangular area.
Definition ckTypes.h:179
Initialization parameters for a CKWindow.
Definition ckWindow.h:44
CKWindowInitParams & SetType(CKWindowType type)
Definition ckWindow.h:68
CKWindowInitParams & UnsetOrigin()
Definition ckWindow.h:78
CKWindowType type
Definition ckWindow.h:48
std::optional< CKPoint > origin
Definition ckWindow.h:47
CKSize size
Definition ckWindow.h:46
CKWindowInitParams(CKSize size)
Initialization parameters for a CKWindow. You must set a size larger than 0x0. Title/type can be set ...
Definition ckWindow.h:59
char * title
Definition ckWindow.h:49
CKWindowInitParams & SetOrigin(CKPoint point)
Definition ckWindow.h:73
CKWindowInitParams & SetTitle(const char *title)
Definition ckWindow.h:63