Skip to content

Commit

Permalink
TabArea and Tabbable Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Neko-Box-Coder committed Oct 27, 2023
1 parent c40ce96 commit ac78ffe
Show file tree
Hide file tree
Showing 4 changed files with 245 additions and 280 deletions.
57 changes: 30 additions & 27 deletions Include/ssGUI/Extensions/TabArea.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ namespace ssGUI
//namespace: ssGUI::Extensions
namespace Extensions
{
/* clang-format off */

/*class: ssGUI::Extensions::TabArea
Allows GUI Objects with <ssGUI::Extensions::Tab> to be tabbed under this extension
Expand All @@ -34,7 +36,7 @@ namespace ssGUI
//See <GetTabBar>
ssGUIObjectIndex TabBar;
//See <GetCurrentTabContent>
ssGUIObjectIndex CurrentTabContent;
Expand All @@ -43,7 +45,7 @@ namespace ssGUI
//See <GetTabContentsHolder>
ssGUIObjectIndex ContentsHolder;
//(Internal variable) Used for holding all the tabs
ssGUIObjectIndex TabsHolder;
Expand All @@ -58,10 +60,10 @@ namespace ssGUI
//See <GetTabPreviewColor>
glm::u8vec4 PreviewColor;
//See <GetOverrideTabPreviewSize>
bool OverrideTabPreviewSize;
//See <GetOverrideTabPreviewSize>
glm::vec2 TabPreviewOverrideSize;
Expand All @@ -70,16 +72,16 @@ namespace ssGUI
//See <GetDefaultTabBarObject>
static ssGUI::GUIObject* DefaultTabBarObject;
//See <GetDefaultTabBarColor>
static glm::u8vec4 DefaultTabBarColor;
//See <GetDefaultTabObject>
static ssGUI::Tab* DefaultTabObject;
//See <GetDefaultTabColor>
static glm::u8vec4 DefaultTabColor;
//See <GetDefaultPreviewColor>
static glm::u8vec4 DefaultPreviewColor;
=================================================================
Expand All @@ -105,6 +107,8 @@ namespace ssGUI
}
=================================================================
*/

/* clang-format on */
class TabArea : public Extension
{
public:
Expand All @@ -131,7 +135,7 @@ namespace ssGUI

//See <GetTabBar>
ssGUIObjectIndex TabBar;

//See <GetCurrentTabContent>
ssGUIObjectIndex CurrentTabContent;

Expand All @@ -140,7 +144,7 @@ namespace ssGUI

//See <GetTabContentsHolder>
ssGUIObjectIndex ContentsHolder;

//(Internal variable) Used for holding all the tabs
ssGUIObjectIndex TabsHolder;

Expand All @@ -155,10 +159,10 @@ namespace ssGUI

//See <GetTabPreviewColor>
glm::u8vec4 PreviewColor;

//See <GetOverrideTabPreviewSize>
bool OverrideTabPreviewSize;

//See <GetOverrideTabPreviewSize>
glm::vec2 TabPreviewOverrideSize;

Expand All @@ -167,16 +171,16 @@ namespace ssGUI

//See <GetDefaultTabBarObject>
static ssGUI::GUIObject* DefaultTabBarObject;

//See <GetDefaultTabBarColor>
static glm::u8vec4 DefaultTabBarColor;

//See <GetDefaultTabObject>
static ssGUI::Tab* DefaultTabObject;

//See <GetDefaultTabColor>
static glm::u8vec4 DefaultTabColor;

//See <GetDefaultPreviewColor>
static glm::u8vec4 DefaultPreviewColor;

Expand Down Expand Up @@ -229,19 +233,18 @@ namespace ssGUI
virtual void UpdateOrientationsForContentsAndPreviews();

virtual bool TabbedIfNeeded(ssGUI::Backend::BackendSystemInputInterface*
inputInterface,
ssGUI::InputStatus& inputStatus,
ssGUI::InputStatus& lastInputStatus,
bool isMouseInsideTabBar,
glm::ivec2 mousePos);
inputInterface,
ssGUI::InputStatus& inputStatus,
ssGUI::InputStatus& lastInputStatus,
bool isMouseInsideTabBar,
glm::ivec2 mousePos);

virtual void SetLastClickedTab(ssGUI::GUIObject* lastTab);

virtual bool SanityCheck() const;

virtual bool CanContentBeTabbed(ssGUI::GUIObject* contentToCheck,
ssGUI::GUIObject* contentTopLevelParent)
const;
ssGUI::GUIObject* contentTopLevelParent) const;

virtual void AddDeletionToCloseButton(ssGUI::Tab* tab);

Expand Down Expand Up @@ -279,7 +282,7 @@ namespace ssGUI

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

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

Expand All @@ -288,11 +291,11 @@ namespace ssGUI

//function: GetDefaultPreviewColor
static glm::u8vec4 GetDefaultPreviewColor();

//====================================================================
//Group: Tab Bar
//====================================================================

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

Expand All @@ -301,7 +304,7 @@ namespace ssGUI

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

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

Expand Down
81 changes: 66 additions & 15 deletions Include/ssGUI/Extensions/Tabbable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,50 @@ namespace ssGUI
//namespace: ssGUI::Extensions
namespace Extensions
{
/* clang-format off */

/*class: ssGUI::Extensions::Tabbable
A template Extension. Use this to create new Extension Classes.
Allows the attached object to be tabbed under <ssGUI::Extensions::TabArea>
Variables & Constructor:
============================== C++ ==============================
protected:
ssGUI::GUIObject* Container; //See <BindToObject>
bool Enabled; //See <IsEnabled>
//See <BindToObject>
ssGUI::GUIObject* Container;
//See <IsEnabled>
bool Enabled;
//See <GetTabAreaObject>
ssGUIObjectIndex TabAreaObject;
//See <Internal_GetObjectsReferences>
ObjectsReferences CurrentObjectsReferences;
//See <GetTopLevelParent>
ssGUIObjectIndex TopLevelParent;
//See <IsUntabbable>
bool Untabbable;
//See <GetLastMouseDragBeginPosition>
glm::vec2 LastMouseDragBeginPosition;
=================================================================
============================== C++ ==============================
Tabbable::Tabbable() : Container(nullptr),
Enabled(true)
{}
Tabbable::Tabbable() :
Container(nullptr),
Enabled(true),
TabAreaObject(-1),
CurrentObjectsReferences(),
TopLevelParent(-1),
Untabbable(false),
LastMouseDragBeginPosition()
{
}
=================================================================
*/

/* clang-format on */
class Tabbable : public Extension
{
public:
Expand All @@ -33,17 +62,26 @@ namespace Extensions
Tabbable& operator=(Tabbable const& other);

protected:
ssGUI::GUIObject* Container; //See <BindToObject>
bool Enabled; //See <IsEnabled>
//See <BindToObject>
ssGUI::GUIObject* Container;

//See <IsEnabled>
bool Enabled;

//See <GetTabAreaObject>
ssGUIObjectIndex TabAreaObject;

ObjectsReferences CurrentObjectsReferences; //See <Internal_GetObjectsReferences>
ssGUIObjectIndex TopLevelParent; //See <GetTopLevelParent>
bool Untabbable; //See
//See <Internal_GetObjectsReferences>
ObjectsReferences CurrentObjectsReferences;

glm::vec2 LastMouseDragBeginPosition = glm::vec2();
//See <GetTopLevelParent>
ssGUIObjectIndex TopLevelParent;

//See <IsUntabbable>
bool Untabbable;

//See <GetLastMouseDragBeginPosition>
glm::vec2 LastMouseDragBeginPosition;

Tabbable();
virtual ~Tabbable() override;
Expand All @@ -58,8 +96,6 @@ namespace Extensions
ssGUI::GUIObject* mainWindow,
glm::vec2 mainWindowPositionOffset) override;

//virtual void DrawTabPreview(glm::vec2 mousePos);

public:
//====================================================================
//Group: Constants
Expand All @@ -68,17 +104,32 @@ namespace Extensions
//string: EXTENSION_NAME
static const std::string EXTENSION_NAME;

//====================================================================
//Group: Tabbable
//====================================================================

//function: SetTopLevelParent
virtual void SetTopLevelParent(ssGUI::GUIObject* topLevelParent);

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

//function: SetUntabbable
virtual void SetUntabbable(bool untabbable);

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

//function: GetLastMouseDragBeginPosition
virtual glm::vec2 GetLastMouseDragBeginPosition() const;

//function: SetLastMouseDragBeginPosition
virtual void SetLastMouseDragBeginPosition(glm::vec2 pos);

//virtual void AddExternalTab(ssGUI::GUIObject* exteranlObject, bool dockAfter);
//function: GetTabAreaObject
ssGUI::GUIObject* GetTabAreaObject() const;

//function: SetTabAreaObject
void SetTabAreaObject(ssGUI::GUIObject* tabArea);


Expand Down
2 changes: 1 addition & 1 deletion Src/ssGUI/Extensions/TabArea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1650,7 +1650,7 @@ namespace ssGUI

ObjectsReferences* TabArea::Internal_GetObjectsReferences()
{
return nullptr;
return &CurrentObjectsReferences;
}

TabArea* TabArea::Clone()
Expand Down
Loading

0 comments on commit ac78ffe

Please sign in to comment.