-
-
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 #174 from edunad/feature/ui-tabs
[UI] Tabs
- Loading branch information
Showing
32 changed files
with
335 additions
and
72 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
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
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
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
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
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,54 @@ | ||
#pragma once | ||
|
||
#include <rawrbox/ui/container.hpp> | ||
#include <rawrbox/ui/elements/button.hpp> | ||
#include <rawrbox/ui/elements/group.hpp> | ||
|
||
#include <utility> | ||
|
||
namespace rawrbox { | ||
struct UITab { | ||
public: | ||
std::string name; | ||
std::string id; | ||
|
||
rawrbox::UIGroup* group = nullptr; | ||
rawrbox::UIButton* button = nullptr; | ||
|
||
UITab(std::string id, std::string name, rawrbox::UIGroup* groupUI) : name(std::move(name)), id(std::move(id)), group(groupUI) {} | ||
}; | ||
|
||
class UITabs : public rawrbox::UIContainer { | ||
|
||
protected: | ||
std::vector<rawrbox::UITab> _tabs = {}; | ||
|
||
rawrbox::UITab* _activeTab = nullptr; | ||
rawrbox::UIGroup* _buttonGroup = nullptr; | ||
|
||
virtual void generate(); | ||
|
||
public: | ||
UITabs(rawrbox::UIRoot* root, const std::vector<rawrbox::UITab>& tabs); | ||
UITabs(const UITabs&) = default; | ||
UITabs(UITabs&&) = delete; | ||
UITabs& operator=(const UITabs&) = default; | ||
UITabs& operator=(UITabs&&) = delete; | ||
~UITabs() override = default; | ||
|
||
void setSize(const rawrbox::Vector2f& size) override; | ||
|
||
// TABS ---- | ||
virtual void setActive(size_t index); | ||
virtual void setEnabled(size_t index, bool enabled); | ||
|
||
[[nodiscard]] virtual float getTabHeight() const; | ||
[[nodiscard]] virtual float getButtonWidth() const; | ||
[[nodiscard]] virtual uint16_t getButtonFontSize() const; | ||
// --------- | ||
|
||
// DRAW ---- | ||
void draw(rawrbox::Stencil& stencil) override; | ||
// ------- | ||
}; | ||
} // namespace rawrbox |
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
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,10 @@ | ||
#pragma once | ||
#include <rawrbox/scripting/utils/lua.hpp> | ||
|
||
namespace rawrbox { | ||
class UITabWrapper { | ||
|
||
public: | ||
static void registerLua(lua_State* L); | ||
}; | ||
} // namespace rawrbox |
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,10 @@ | ||
#pragma once | ||
#include <rawrbox/scripting/utils/lua.hpp> | ||
|
||
namespace rawrbox { | ||
class UITabsWrapper { | ||
|
||
public: | ||
static void registerLua(lua_State* L); | ||
}; | ||
} // namespace rawrbox |
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
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.