Skip to content

Commit

Permalink
Override SetInteractable and SetBlockInput in all composite objects...
Browse files Browse the repository at this point in the history
Override SetInteractable and SetBlockInput in all composite objects (PZ3A8l51R6)
  • Loading branch information
Neko-Box-Coder committed May 14, 2023
1 parent e50102a commit 4df2067
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Include/ssGUI/GUIObjectClasses/CompositeClasses/Dropdown.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,22 @@ namespace ssGUI
//Passing nullptr will unset the dropdown menu object.
virtual void SetDropdownMenu(ssGUI::Menu* menu);

//function: SetInteractable
//See <Widget::SetInteractable>
virtual void SetInteractable(bool interactable) override;

//function: SetBlockInput
//See <Widget::SetBlockInput>
virtual void SetBlockInput(bool blockInput) override;

//function: GetType
//See <Widget::GetType>
virtual ssGUI::Enums::GUIObjectType GetType() const override;

//function: Clone
//See <Widget::Clone>
virtual Dropdown* Clone(bool cloneChildren) override;

//function: InitiateDefaultResources
//See <GUIObject::InitiateDefaultResources>
virtual void InitiateDefaultResources() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,14 @@ namespace ssGUI
//For description of SetImageData, see <ssGUI::Image::SetImageData>
virtual void SetImageData(ssGUI::ImageData* imageData) override;

//function: SetInteractable
//See <Widget::SetInteractable>
virtual void SetInteractable(bool interactable) override;

//function: SetBlockInput
//See <Widget::SetBlockInput>
virtual void SetBlockInput(bool blockInput) override;

//function: GetType
//See <ssGUI::Widget::GetType>
virtual ssGUI::Enums::GUIObjectType GetType() const override;
Expand Down
8 changes: 8 additions & 0 deletions Include/ssGUI/GUIObjectClasses/CompositeClasses/Slider.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,14 @@ namespace ssGUI
//This only limits to move in an interval so this is different from snapping.
virtual float GetKeyInputMoveInterval() const;

//function: SetInteractable
//See <Widget::SetInteractable>
virtual void SetInteractable(bool interactable) override;

//function: SetBlockInput
//See <Widget::SetBlockInput>
virtual void SetBlockInput(bool blockInput) override;

//function: GetType
//See <Widget::GetType>
virtual ssGUI::Enums::GUIObjectType GetType() const override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,14 @@ namespace ssGUI
//function: SetButtonColor
//See <Button::SetButtonColor>
virtual void SetButtonColor(glm::u8vec4 color) override;

//function: SetInteractable
//See <Widget::SetInteractable>
virtual void SetInteractable(bool interactable) override;

//function: SetBlockInput
//See <Widget::SetBlockInput>
virtual void SetBlockInput(bool blockInput) override;

//function: GetType
//See <Widget::GetType>
Expand Down
16 changes: 16 additions & 0 deletions Src/ssGUI/GUIObjectClasses/CompositeClasses/Dropdown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,22 @@ namespace ssGUI
for(int i = 0; i < itemsCopy.size(); i++)
AddItem(itemsCopy[i].first);
}

void Dropdown::SetInteractable(bool interactable)
{
if(GetDropdownMenu() != nullptr)
GetDropdownMenu()->SetInteractable(interactable);

StandardButton::SetInteractable(interactable);
}

void Dropdown::SetBlockInput(bool blockInput)
{
if(GetDropdownMenu() != nullptr)
GetDropdownMenu()->SetBlockInput(blockInput);

StandardButton::SetBlockInput(blockInput);
}

ssGUI::Enums::GUIObjectType Dropdown::GetType() const
{
Expand Down
22 changes: 22 additions & 0 deletions Src/ssGUI/GUIObjectClasses/CompositeClasses/ImageCanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,28 @@ namespace ssGUI
ssGUI::Image::SetImageData(imageData);
CenterViewportToImage();
}

void ImageCanvas::SetInteractable(bool interactable)
{
if(GetHorizontalScrollbar() != nullptr)
GetHorizontalScrollbar()->SetInteractable(interactable);

if(GetVerticalScrollbar() != nullptr)
GetVerticalScrollbar()->SetInteractable(interactable);

Image::SetInteractable(interactable);
}

void ImageCanvas::SetBlockInput(bool blockInput)
{
if(GetHorizontalScrollbar() != nullptr)
GetHorizontalScrollbar()->SetBlockInput(blockInput);

if(GetVerticalScrollbar() != nullptr)
GetVerticalScrollbar()->SetBlockInput(blockInput);

Image::SetBlockInput(blockInput);
}

ssGUI::Enums::GUIObjectType ImageCanvas::GetType() const
{
Expand Down
16 changes: 16 additions & 0 deletions Src/ssGUI/GUIObjectClasses/CompositeClasses/Slider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,22 @@ namespace ssGUI
{
return KeyInputInterval;
}

void Slider::SetInteractable(bool interactable)
{
if(GetKnobObject() != nullptr)
GetKnobObject()->SetInteractable(interactable);

Widget::SetInteractable(interactable);
}

void Slider::SetBlockInput(bool blockInput)
{
if(GetKnobObject() != nullptr)
GetKnobObject()->SetBlockInput(blockInput);

Widget::SetBlockInput(blockInput);
}

ssGUI::Enums::GUIObjectType Slider::GetType() const
{
Expand Down
19 changes: 19 additions & 0 deletions Src/ssGUI/GUIObjectClasses/CompositeClasses/StandardButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,25 @@ namespace ssGUI
GetButtonTextObject()->SetNewTextColor(glm::u8vec4((uint8_t)textResult.r, (uint8_t)textResult.g, (uint8_t)textResult.b, (uint8_t)textResult.a));
GetButtonTextObject()->ApplyNewTextSettingsToExistingText();
}

void StandardButton::SetInteractable(bool interactable)
{
if(GetButtonTextObject() != nullptr)
GetButtonTextObject()->SetInteractable(interactable);

if(GetButtonIconObject() != nullptr)
GetButtonIconObject()->SetInteractable(interactable);

Button::SetInteractable(interactable);
}

void StandardButton::SetBlockInput(bool blockInput)
{
if(GetButtonIconObject() != nullptr)
GetButtonIconObject()->SetBlockInput(blockInput);

Button::SetBlockInput(blockInput);
}

ssGUI::Enums::GUIObjectType StandardButton::GetType() const
{
Expand Down

0 comments on commit 4df2067

Please sign in to comment.