forked from Neko-Box-Coder/ssGUI
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Neko-Box-Coder#33 from Neko-Box-Coder/Tabbable
Window Tab extension (Rf8FO9AQjv)
- Loading branch information
Showing
17 changed files
with
3,423 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef SSGUI_TAB_EVENT_INFO_HPP | ||
#define SSGUI_TAB_EVENT_INFO_HPP | ||
|
||
//namespace: ssGUI | ||
namespace ssGUI | ||
{ | ||
class GUIObject; | ||
|
||
class Tab; | ||
|
||
//struct: ssGUI::TabEventInfo | ||
//Custom event info for NEW_TAB_CONTENT_ADDED, TAB_CONTENT_SWITCHED and TAB_CONTENT_UNTABBED | ||
//events | ||
struct TabEventInfo | ||
{ | ||
//var: TabAreaContainer | ||
//Pointer to the GUI Object that has the tab area extension attached | ||
ssGUI::GUIObject* TabAreaContainer = nullptr; | ||
|
||
//var: Tab | ||
//Pointer to the tab that is related to the event. | ||
//For TAB_CONTENT_UNTABBED event, this will be nullptr. | ||
//For TAB_CONTENT_SWITCHED event, this can be nullptr if no tab is selected. | ||
ssGUI::Tab* Tab = nullptr; | ||
}; | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
#ifndef SSGUI_DIRECTION_HPP | ||
#define SSGUI_DIRECTION_HPP | ||
|
||
#include "ssGUI/HelperClasses/EnumToStringMacro.hpp" | ||
#include <cstdint> | ||
#include <string> | ||
|
||
namespace ssGUI | ||
{ | ||
|
||
//namespace: ssGUI::Enums | ||
namespace Enums | ||
{ | ||
/*enum: Direction | ||
Bitfiled type that represents a combination of directions. | ||
TOP - Top | ||
RIGHT - Right | ||
BOTTOM - Bottom | ||
LEFT - Left | ||
COUNT - Count | ||
*/ | ||
enum class Direction : uint8_t | ||
{ | ||
TOP = 1 << 0, | ||
RIGHT = 1 << 1, | ||
BOTTOM = 1 << 2, | ||
LEFT = 1 << 3, | ||
COUNT = 1 << 4 | ||
}; | ||
|
||
namespace | ||
{ | ||
inline std::string Internal_DirectionToString(Direction anchor) | ||
{ | ||
static_assert((uint8_t)Direction::COUNT == 1 << 4, "ToString"); | ||
switch(anchor) | ||
{ | ||
RETURN_ENUM_STRING(Direction::TOP); | ||
RETURN_ENUM_STRING(Direction::RIGHT); | ||
RETURN_ENUM_STRING(Direction::BOTTOM); | ||
RETURN_ENUM_STRING(Direction::LEFT); | ||
RETURN_ENUM_STRING(Direction::COUNT); | ||
} | ||
|
||
return ""; | ||
} | ||
} | ||
|
||
inline ssGUI::Enums::Direction operator|(ssGUI::Enums::Direction a, | ||
ssGUI::Enums::Direction b) | ||
{ | ||
return static_cast<ssGUI::Enums::Direction>(static_cast<uint8_t>(a) | | ||
static_cast<uint8_t>(b)); | ||
}; | ||
|
||
inline ssGUI::Enums::Direction operator&(ssGUI::Enums::Direction a, | ||
ssGUI::Enums::Direction b) | ||
{ | ||
return static_cast<ssGUI::Enums::Direction>(static_cast<uint8_t>(a) & | ||
static_cast<uint8_t>(b)); | ||
}; | ||
|
||
inline bool operator==(ssGUI::Enums::Direction a, ssGUI::Enums::Direction b) | ||
{ | ||
return (static_cast<uint8_t>(a & b) == static_cast<uint8_t>(b)); | ||
}; | ||
|
||
inline bool operator!=(ssGUI::Enums::Direction a, ssGUI::Enums::Direction b) | ||
{ | ||
return !(a == b); | ||
}; | ||
|
||
//function: DirectionToString | ||
inline std::string DirectionToString(Direction direction) | ||
{ | ||
static_assert((uint8_t)Direction::COUNT == 1 << 4, "ToString"); | ||
|
||
std::string curString; | ||
for(int i = 0; i < 4; ++i) | ||
{ | ||
std::string returnString = | ||
Internal_DirectionToString(direction & (Direction)(1 << i)); | ||
if(!returnString.empty()) | ||
curString += returnString + ", "; | ||
} | ||
|
||
//Remove last comma | ||
if(!curString.empty()) | ||
curString.erase(curString.begin() + curString.size() - 2); | ||
|
||
return curString; | ||
} | ||
} | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.