Skip to content

Commit

Permalink
Text modified & finished modifying via GUI event callback (AfoI5x7b6P)
Browse files Browse the repository at this point in the history
  • Loading branch information
Neko-Box-Coder committed Aug 28, 2023
1 parent 43a4a8c commit e6dd06b
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 72 deletions.
101 changes: 55 additions & 46 deletions Include/ssGUI/Enums/EventType.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,56 +13,59 @@ namespace ssGUI
{
/* enum: EventType
NONE - Default event type
BACKGROUND_COLOR_CHANGED - Triggered *after* the background color is changed. Container will be the source for triggering this event callback.
NONE - Default event type
BACKGROUND_COLOR_CHANGED - Triggered *after* the background color is changed. Container will be the source for triggering this event callback.
BEFORE_FONT_CHANGE - Triggered *before* the font of a text is changed. Text(Container) will be the source for triggering this event callback.
Please note that this is not triggered by any changes to default fonts.
BEFORE_FONT_CHANGE - Triggered *before* the font of a text is changed. Text(Container) will be the source for triggering this event callback.
Please note that this is not triggered by any changes to default fonts.
BEFORE_OBJECT_DESTROY - Triggered *before* the GUI object is destroyed. Container will be the source for triggering this event callback.
BEFORE_OBJECT_RENDER - Triggered *before* this GUI Object is drawing to the MainWindow. MainWindow will be the source for triggering this event callback.
You can call <ssGUI::Renderer::IsRedrawNeeded> to determine if cache is being drawn or not.
BEFORE_OBJECT_DESTROY - Triggered *before* the GUI object is destroyed. Container will be the source for triggering this event callback.
BEFORE_OBJECT_RENDER - Triggered *before* this GUI Object is drawing to the MainWindow. MainWindow will be the source for triggering this event callback.
You can call <ssGUI::Renderer::IsRedrawNeeded> to determine if cache is being drawn or not.
BEFORE_RECURSIVE_CHILD_ADD - Triggered *before* a child is paranted recursively on this GUI object. The child object being added will be the source for triggering this event callback.
BEFORE_RECURSIVE_CHILD_REMOVE - Triggered *before* a child is removed recursively on this GUI object. The child object being removed will be the source for triggering this event callback.
BEFORE_WINDOW_CLOSE - Triggered *before* this GUI Object (Window) is closed. Window(Container) will be the source for triggering this event callback.
BEFORE_OBJECT_UPDATE - Triggered *before* this GUI object is being updated. Container will be the source for triggering this event callback.
<ssGUI::EventInfo::CustomInfo> will be pointer to <ssGUI::ObjectUpdateInfo> struct.
BEFORE_RECURSIVE_CHILD_ADD - Triggered *before* a child is paranted recursively on this GUI object. The child object being added will be the source for triggering this event callback.
BEFORE_RECURSIVE_CHILD_REMOVE - Triggered *before* a child is removed recursively on this GUI object. The child object being removed will be the source for triggering this event callback.
BEFORE_WINDOW_CLOSE - Triggered *before* this GUI Object (Window) is closed. Window(Container) will be the source for triggering this event callback.
BEFORE_OBJECT_UPDATE - Triggered *before* this GUI object is being updated. Container will be the source for triggering this event callback.
<ssGUI::EventInfo::CustomInfo> will be pointer to <ssGUI::ObjectUpdateInfo> struct.
BUTTON_STATE_CHANGED - Triggered *after* the button state has changed. Button(Container) will be the source for triggering this event callback.
CHILD_ADDED - Triggered *after* a child is paranted on this GUI object. The child object being added will be the source for triggering this event callback.
CHILD_POSITION_CHANGED - Triggered *after* <ssGUI::Hierarchy::ChangeChildOrderToBeforePosition> or <ssGUI::Hierarchy::ChangeChildOrderToAfterPosition> is called.
The child that is passed to <ssGUI::Hierarchy::ChangeChildOrderToBeforePosition> or <ssGUI::Hierarchy::ChangeChildOrderToAfterPosition> will be the source
for triggering this event callback.
The event will only be triggered once as a result of the ChangeChildOrderToXXXPosition function
and will not be triggered by the change of position for other children as a result of this function call.
Meaning only the child GUI Object that is being **actively** changed position will have the event triggered
(i.e. the child that is passed to the function for changing the position).
CHILD_REMOVED - Triggered *after* a child is removed on this GUI object. The child object being removed will be the source for triggering this event callback.
FOCUSED - Triggered *after* the GUI Object gained focus
FOCUS_LOST - Triggered *after* the GUI Object lost focus
ITEM_SELECTED - Triggered *after* an item is selected. Dropdown(Container) will be the source for triggering this event callback.
MIN_MAX_SIZE_CHANGED - Triggered *after* min or max size of a GUI object has changed. Container will be the source for triggering this event callback.
OBJECT_RENDERED - Triggered *after* this GUI Object is drawing to the MainWindow. MainWindow will be the source for triggering this event callback.
You can call <ssGUI::Renderer::IsRedrawNeeded> to determine if cache is being drawn or not
BUTTON_STATE_CHANGED - Triggered *after* the button state has changed. Button(Container) will be the source for triggering this event callback.
CHILD_ADDED - Triggered *after* a child is paranted on this GUI object. The child object being added will be the source for triggering this event callback.
CHILD_POSITION_CHANGED - Triggered *after* <ssGUI::Hierarchy::ChangeChildOrderToBeforePosition> or <ssGUI::Hierarchy::ChangeChildOrderToAfterPosition> is called.
The child that is passed to <ssGUI::Hierarchy::ChangeChildOrderToBeforePosition> or <ssGUI::Hierarchy::ChangeChildOrderToAfterPosition> will be the source
for triggering this event callback.
The event will only be triggered once as a result of the ChangeChildOrderToXXXPosition function
and will not be triggered by the change of position for other children as a result of this function call.
Meaning only the child GUI Object that is being **actively** changed position will have the event triggered
(i.e. the child that is passed to the function for changing the position).
CHILD_REMOVED - Triggered *after* a child is removed on this GUI object. The child object being removed will be the source for triggering this event callback.
FOCUSED - Triggered *after* the GUI Object gained focus
FOCUS_LOST - Triggered *after* the GUI Object lost focus
ITEM_SELECTED - Triggered *after* an item is selected. Dropdown(Container) will be the source for triggering this event callback.
MIN_MAX_SIZE_CHANGED - Triggered *after* min or max size of a GUI object has changed. Container will be the source for triggering this event callback.
OBJECT_RENDERED - Triggered *after* this GUI Object is drawing to the MainWindow. MainWindow will be the source for triggering this event callback.
You can call <ssGUI::Renderer::IsRedrawNeeded> to determine if cache is being drawn or not
TEXT_CONTENT_CHANGED - Triggered *shortly after* there's a text content change (Not visual change such as underline or bold).
The text GUI object that has the text being changed will be the source for triggering this event callback.
RECURSIVE_CHILD_ADDED - Triggered *after* a child is paranted recursively on this GUI object. The child object being added will be the source for triggering this event callback.
RECURSIVE_CHILD_REMOVED - Triggered *after* a child is removed recursively on this GUI object. The child object being removed will be the source for triggering this event callback.
SIZE_CHANGED - Triggered *after* this GUI object's size has changed. Container will be the source for triggering this event callback.
SLIDER_VALUE_CHANGED - Triggered *shortly after* the value of the slider is changed.
SLIDER_VALUE_CHANGED_VIA_GUI - Triggered *shortly after* the value of the slider is changed by user input.
SLIDER_VALUE_FINISHED_CHANGING - Triggered *shortly after* the value of the slider has *finished* changing.
Meaning this will be triggered if the slider value stayed the same for current update *and* the previous update it has been changed.
WINDOW_DRAG_STATE_CHANGED - Triggered *after* this GUI object (window) drag state is changed. Window(Container) will be the source for triggering this event callback.
OBJECT_UPDATED - Triggered *after* this GUI object is being updated. Container will be the source for triggering this event callback.
<ssGUI::EventInfo::CustomInfo> will be pointer to <ssGUI::ObjectUpdateInfo> struct.
TEXT_FIELD_CONTENT_CHANGED_VIA_GUI - Triggered *after* the content of the text field is edited by user input
TEXT_FIELD_CONTENT_FINISHED_CHANGING_VIA_GUI - Triggered *after* the content of the text field is finished editing by user input, either by deselecting the GUI Object
or a period of time (default 500ms) without user input
RECURSIVE_CHILD_ADDED - Triggered *after* a child is paranted recursively on this GUI object. The child object being added will be the source for triggering this event callback.
RECURSIVE_CHILD_REMOVED - Triggered *after* a child is removed recursively on this GUI object. The child object being removed will be the source for triggering this event callback.
SIZE_CHANGED - Triggered *after* this GUI object's size has changed. Container will be the source for triggering this event callback.
SLIDER_VALUE_CHANGED - Triggered *shortly after* the value of the slider is changed. This is triggered under the <ssGUI::Slider::MainLogic> method therefore the event is not immediate.
SLIDER_VALUE_CHANGED_VIA_GUI - Triggered *shortly after* the value of the slider is changed. This is triggered under the <ssGUI::Slider::MainLogic> method therefore the event is not immediate.
SLIDER_VALUE_FINISHED_CHANGING - Triggered *shortly after* the value of the slider has *finished* changing.
Meaning this will be triggered if the slider value stayed the same for current update
*and* the previous update it has been changed.
This is triggered under the <ssGUI::Slider::MainLogic> method therefore the event is not immediate.
WINDOW_DRAG_STATE_CHANGED - Triggered *after* this GUI object (window) drag state is changed. Window(Container) will be the source for triggering this event callback.
OBJECT_UPDATED - Triggered *after* this GUI object is being updated. Container will be the source for triggering this event callback.
<ssGUI::EventInfo::CustomInfo> will be pointer to <ssGUI::ObjectUpdateInfo> struct.
TEXT_CONTENT_CHANGED - Triggered *shortly after* there's a text content change (Not visual change such as underline or bold).
The text GUI object that has the text being changed will be the source for triggering this event callback.
COUNT - Count
SCROLLBAR_VALUE_CHANGED - Same as <SLIDER_VALUE_CHANGED>
Expand Down Expand Up @@ -101,6 +104,9 @@ namespace ssGUI
WINDOW_DRAG_STATE_CHANGED,
OBJECT_UPDATED,

TEXT_FIELD_CONTENT_CHANGED_VIA_GUI,
TEXT_FIELD_CONTENT_FINISHED_CHANGING_VIA_GUI,

COUNT,

SCROLLBAR_VALUE_CHANGED = SLIDER_VALUE_CHANGED,
Expand All @@ -111,7 +117,7 @@ namespace ssGUI
//function: EventTypeToString
inline std::string EventTypeToString(EventType event)
{
static_assert((int)EventType::COUNT == 27, "ToString");
static_assert((int)EventType::COUNT == 29, "ToString");
switch(event)
{
RETURN_ENUM_STRING(EventType::NONE);
Expand Down Expand Up @@ -144,6 +150,9 @@ namespace ssGUI
RETURN_ENUM_STRING(EventType::WINDOW_DRAG_STATE_CHANGED);
RETURN_ENUM_STRING(EventType::OBJECT_UPDATED);

RETURN_ENUM_STRING(EventType::TEXT_FIELD_CONTENT_CHANGED_VIA_GUI);
RETURN_ENUM_STRING(EventType::TEXT_FIELD_CONTENT_FINISHED_CHANGING_VIA_GUI);

RETURN_ENUM_STRING(EventType::COUNT);
}

Expand Down
Loading

0 comments on commit e6dd06b

Please sign in to comment.