Skip to content

Commit

Permalink
Tab GUI Object Update & removed dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
Neko-Box-Coder committed Oct 28, 2023
1 parent ac78ffe commit 44e2155
Show file tree
Hide file tree
Showing 3 changed files with 275 additions and 182 deletions.
160 changes: 123 additions & 37 deletions Include/ssGUI/GUIObjectClasses/CompositeClasses/Tab.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,115 @@
//namespace: ssGUI
namespace ssGUI
{
/* clang-format off */
/*class: Tab
A template GUI Object. Use this to create new GUI Object Classes.
A tab GUI object that is normally generated by <ssGUI::Extensions::TabArea>
Variables & Constructor:
============================== C++ ==============================
protected:
//See <GetTabColor>
glm::u8vec4 TabColor;
//See <GetSelectedColor>
glm::u8vec4 SelectedColor;
//See <GetUnderlineColor>
glm::u8vec4 UnderlineColor;
//See <GetUnderlineThickness>
float UnderlineThickness;
//See <GetUnderlineDirection>
ssGUI::Enums::Direction UnderlineDirection;
//See <GetCloseButton>
ssGUIObjectIndex CloseButton;
//(Internal variable) Shape Ids for the close button
int CloseButtonShapeIds[2];
//See <GetAssociatedContent>
ssGUIObjectIndex ContentObject;
//See <IsTabSelected>
bool Selected = false;
//(Internal variable) Default size for close button
static glm::vec2 DefaultCloseButtonSize;
=================================================================
============================== C++ ==============================
Tab::Tab()
Tab::Tab() :
StandardButton(),
TabColor(100, 100, 100, 255),
SelectedColor(127, 127, 127, 255),
UnderlineColor(255, 255, 255, 127),
UnderlineThickness(3),
UnderlineDirection(ssGUI::Enums::Direction::BOTTOM),
CloseButton(-1),
CloseButtonShapeIds{-1, -1},
ContentObject(-1),
Selected(false)
{
GetExtension<ssGUI::Extensions::Layout>()->ClearAllPreferredSizeMultiplier();
RemoveExtension<ssGUI::Extensions::RoundedCorners>();
RemoveExtension<ssGUI::Extensions::Outline>();
auto* boxShadow = GetExtension<ssGUI::Extensions::BoxShadow>();
boxShadow->SetSizeOffset(glm::vec2(boxShadow->GetSizeOffset().x, 0));
GetButtonTextObject()->SetNewTextFontSize(14);
InitializeCloseButton();
}
=================================================================
*/
/* clang-format on */
class Tab : public StandardButton
{
private:
Tab& operator=(Tab const& other) = default;
Tab& operator=(const Tab& other) = default;

protected:
glm::u8vec4 TabColor = glm::u8vec4(100, 100, 100, 255);
glm::u8vec4 SelectedColor = glm::u8vec4(127, 127, 127, 255);
glm::u8vec4 UnderlineColor = glm::u8vec4(255, 255, 255, 127);
//See <GetTabColor>
glm::u8vec4 TabColor;

//See <GetSelectedColor>
glm::u8vec4 SelectedColor;

//See <GetUnderlineColor>
glm::u8vec4 UnderlineColor;

float UnderlineThickness = 3;
ssGUI::Enums::Direction UnderlineDirection = ssGUI::Enums::Direction::BOTTOM;

//See <GetUnderlineThickness>
float UnderlineThickness;

//See <GetUnderlineDirection>
ssGUI::Enums::Direction UnderlineDirection;

//See <GetCloseButton>
ssGUIObjectIndex CloseButton;

//(Internal variable) Shape Ids for the close button
int CloseButtonShapeIds[2];

//See <GetAssociatedContent>
ssGUIObjectIndex ContentObject;

//See <IsTabSelected>
bool Selected = false;


//(Internal variable) Default size for close button
static glm::vec2 DefaultCloseButtonSize;
Tab(Tab const& other);

Tab(const Tab& other);

virtual void SetCloseSymbolColor(glm::u8vec4 color);

virtual void InitializeCloseButton();
virtual void MainLogic( ssGUI::Backend::BackendSystemInputInterface* inputInterface,
ssGUI::InputStatus& currentInputStatus,
ssGUI::InputStatus& lastInputStatus,
ssGUI::GUIObject* mainWindow) override;

virtual void MainLogic(ssGUI::Backend::BackendSystemInputInterface* inputInterface,
ssGUI::InputStatus& currentInputStatus,
ssGUI::InputStatus& lastInputStatus,
ssGUI::GUIObject* mainWindow) override;

public:
//====================================================================
Expand All @@ -63,47 +128,69 @@ namespace ssGUI
Tab();
virtual ~Tab() override;

//====================================================================
//Group: Methods
//====================================================================
//function: SetAssociatedContent
virtual void SetAssociatedContent(ssGUI::GUIObject* content);

//function: GetAssociatedContent
virtual ssGUI::GUIObject* GetAssociatedContent() const;

//function: SetTabColor
virtual void SetTabColor(glm::u8vec4 color);


//function: GetTabColor
virtual glm::u8vec4 GetTabColor() const;


//function: SetSelectedColor
virtual void SetSelectedColor(glm::u8vec4 color);


//function: GetSelectedColor
virtual glm::u8vec4 GetSelectedColor() const;


//function: SetUnderlineColor
virtual void SetUnderlineColor(glm::u8vec4 color);


//function: GetUnderlineColor
virtual glm::u8vec4 GetUnderlineColor() const;


//function: SetUnderlineDirection
virtual void SetUnderlineDirection(ssGUI::Enums::Direction direction);


//function: GetUnderlineDirection
virtual ssGUI::Enums::Direction GetUnderlineDirection() const;


//function: SetUnderlineThickness
virtual void SetUnderlineThickness(float thickness);


//function: GetUnderlineThickness
virtual float GetUnderlineThickness() const;


//function: SetCloseButton
virtual void SetCloseButton(ssGUI::Button* button);


//function: GetCloseButton
virtual ssGUI::Button* GetCloseButton() const;


//function: SelectTab
virtual void SelectTab(bool select);


//function: IsTabSelected
virtual bool IsTabSelected() const;

//function: SetTabIcon
virtual void SetTabIcon(ssGUI::Image* icon);


//function: GetTabIcon
virtual ssGUI::Image* GetTabIcon() const;


//function: SetTabTitleObject
virtual void SetTabTitleObject(ssGUI::Text* title);


//function: GetTabTitleObject
virtual ssGUI::Text* GetTabTitleObject() const;


//====================================================================
//Group: Overrides
//====================================================================
Expand All @@ -115,7 +202,6 @@ namespace ssGUI
//function: Clone
//See <Widget::Clone>
virtual Tab* Clone(bool cloneChildren) override;

};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -796,15 +796,8 @@ namespace Backend
XTranslateCoordinates(WindowDisplay, WindowId, RootWindow(WindowDisplay, DefaultScreen(WindowDisplay)),
0, 0, &renderPosX, &renderPosY, &curWindow );

//ssLOG_LINE("xy: " << renderPosX << ", " << renderPosY);
//ssLOG_LINE("attr: "<<attr.x<<", "<<attr.y);

int top, right, left, bot;
GetWindowDecor(top, right, bot, left);

//ssLOG_LINE("decor: "<<left<<", "<<top);

//return glm::ivec2(x - attr.x - left, y - attr.y - top);
return glm::ivec2(renderPosX - left, renderPosY - top);
}

Expand Down
Loading

0 comments on commit 44e2155

Please sign in to comment.