19#include <MacWindows.h>
116 const std::vector<CKControl*>&
GetControls()
const;
125 template <
typename T>
129 out.reserve(__controls.size());
130 for (
auto* c : __controls) {
131 if (
auto* t =
dynamic_cast<T*
>(c)) {
154 void __InvalidateEntireWindow();
182 std::vector<CKControl*> __controls;
184 CKControl* __activeTextInputControl =
nullptr;
187 bool __isCurrentlyActive =
false;
189 std::vector<CKRect> __controlDirtifiedAreas;
Defines the main entry point for a Clapkit application.
Definition ckApp.h:58
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:91
const CKWindowPtr GetWindowPtr() const
Definition ckWindow.cpp:557
void RemoveControl(CKControl *control, bool free)
Definition ckWindow.cpp:272
const std::vector< CKControl * > & GetControls() const
Get the list of controls in this window.
Definition ckWindow.cpp:458
void Center()
Definition ckWindow.cpp:200
bool AddControl(CKControl *control)
Definition ckWindow.cpp:235
CKProperty< CKRect > rect
Definition ckWindow.h:163
CKControl * GetLastControl() const
Definition ckWindow.cpp:547
CKProperty< CKColor > backgroundColor
Definition ckWindow.h:166
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:178
void SetIsActive(bool active)
Definition ckWindow.cpp:524
CKProperty< bool > visible
Definition ckWindow.h:164
void DirtyArea(const CKRect r)
Definition ckWindow.cpp:567
int minimumHeight
Definition ckWindow.h:170
CKProperty< bool > hasCustomBackgroundColor
Definition ckWindow.h:165
void SetLastControl(CKControl *control)
Definition ckWindow.cpp:552
void Redraw(CKRect rectToRedraw)
Definition ckWindow.cpp:308
int minimumWidth
Definition ckWindow.h:169
bool GetIsActive()
Definition ckWindow.cpp:562
void SetTitle(const char *title)
Definition ckWindow.cpp:140
void PreparePortForControlDraw()
Definition ckWindow.cpp:379
CKProperty< bool > closable
Definition ckWindow.h:167
CKApp * GetOwner()
Return the app this window is a part of.
Definition ckWindow.cpp:422
virtual ~CKWindow()
Definition ckWindow.cpp:102
void __ReflectToOS()
Definition ckWindow.cpp:626
char * GetTitle()
Definition ckWindow.cpp:152
int maximumHeight
Definition ckWindow.h:172
virtual void RaisePropertyChange(const char *propertyName)
Definition ckWindow.cpp:648
void Show()
Definition ckWindow.cpp:167
void Close()
Definition ckWindow.cpp:212
virtual bool HandleEvent(const CKEvent &evt)
Definition ckWindow.cpp:585
CKControl * FindControl(CKPoint point)
Definition ckWindow.cpp:435
void Loop()
Called from CKApp to do stuff like blinking the caret, etc.
Definition ckWindow.cpp:128
void Focus()
Make the window foremost window. Make visible if invisible.
Definition ckWindow.cpp:189
std::vector< T * > GetControlsOfType() const
Get the list of controls of type T in this window.
Definition ckWindow.h:126
void SetOwner(CKApp *owner)
Definition ckWindow.cpp:414
void SetActiveControl(CKControl *control)
Called by ckApp on a click event - to set the active control (like a textfield.)
Definition ckWindow.cpp:496
bool ContainsControl(CKControl *control)
Definition ckWindow.cpp:465
void Hide()
Definition ckWindow.cpp:179
int maximumWidth
Definition ckWindow.h:171
CKFocusableControl * GetActiveControl()
Called by ckApp to determine UI Changes needed, like enabling/disabling menu items.
Definition ckWindow.cpp:483
#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:29
Defines an RGB color. A (Alpha) is usually not used in our case.
Definition ckTypes.h:88
Defines an event raised by the framework, mostly for user actions.
Definition ckTypes.h:496
Defines a point on the screen.
Definition ckTypes.h:122
Defines a rectangular area at a specific location.
Definition ckTypes.h:228
Defines a rectangular area.
Definition ckTypes.h:180
Initialization parameters for a CKWindow.
Definition ckWindow.h:46
CKWindowInitParams & SetType(CKWindowType type)
Definition ckWindow.h:70
CKWindowInitParams & UnsetOrigin()
Definition ckWindow.h:80
CKWindowType type
Definition ckWindow.h:50
std::optional< CKPoint > origin
Definition ckWindow.h:49
CKSize size
Definition ckWindow.h:48
CKWindowInitParams(CKSize size)
Initialization parameters for a CKWindow. You must set a size larger than 0x0. Title/type can be set ...
Definition ckWindow.h:61
char * title
Definition ckWindow.h:51
CKWindowInitParams & SetOrigin(CKPoint point)
Definition ckWindow.h:75
CKWindowInitParams & SetTitle(const char *title)
Definition ckWindow.h:65