30#include <TGUI/Widget.hpp>
31#include <TGUI/Renderers/TabsRenderer.hpp>
32#include <TGUI/Text.hpp>
45 typedef std::shared_ptr<Tabs>
Ptr;
150 std::size_t
add(
const sf::String& text,
bool select =
true);
161 void insert(std::size_t index,
const sf::String& text,
bool select =
true);
393 void leftMousePressed(
Vector2f pos)
override;
398 void mouseMoved(
Vector2f pos)
override;
403 void mouseNoLongerOnWidget()
override;
413 void draw(sf::RenderTarget& target, sf::RenderStates states)
const override;
434 void recalculateTabsWidth();
440 void updateTextColors();
455 std::unique_ptr<DataIO::Node>
save(SavingRenderersMap& renderers)
const override;
461 void load(
const std::unique_ptr<DataIO::Node>& node,
const LoadingRenderersMap& renderers)
override;
469 return std::make_shared<Tabs>(*
this);
476 SignalString onTabSelect = {
"TabSelected"};
481 unsigned int m_requestedTextSize = 0;
482 float m_maximumTabWidth = 0;
483 float m_minimumTabWidth = 0;
484 int m_selectedTab = -1;
485 int m_hoveringTab = -1;
486 bool m_autoSize =
true;
495 std::vector<Tab> m_tabs;
499 Sprite m_spriteSelectedTab;
500 Sprite m_spriteSelectedTabHover;
501 Sprite m_spriteDisabledTab;
505 Color m_borderColorCached;
506 Color m_backgroundColorCached;
507 Color m_backgroundColorHoverCached;
508 Color m_backgroundColorDisabledCached;
509 Color m_selectedBackgroundColorCached;
510 Color m_selectedBackgroundColorHoverCached;
511 Color m_textColorCached;
512 Color m_textColorHoverCached;
513 Color m_textColorDisabledCached;
514 Color m_selectedTextColorCached;
515 Color m_selectedTextColorHoverCached;
516 float m_distanceToSideCached = 0;
Wrapper for colors.
Definition: Color.hpp:49
Class to store the position or size of a widget.
Definition: Layout.hpp:260
Definition: Outline.hpp:39
Signal to which the user can subscribe to get callbacks from.
Definition: Signal.hpp:231
Definition: Sprite.hpp:46
Definition: TabsRenderer.hpp:37
Tabs widget.
Definition: Tabs.hpp:42
TabsRenderer * getRenderer()
Returns the renderer, which gives access to functions that determine how the widget is displayed.
void setAutoSize(bool autoSize)
Changes whether the tabs are auto-sized or not.
static Tabs::Ptr create()
Creates a new tabs widget.
bool select(std::size_t index)
Selects the tab with a given index.
bool getTabEnabled(std::size_t index) const
Returns whether the tab is enabled or disabled.
sf::String getSelected() const
Gets the text that is drawn on the currently selected tab.
void setTabEnabled(std::size_t index, bool enabled)
Changes whether a tab is enabled.
void insert(std::size_t index, const sf::String &text, bool select=true)
Inserts a new tab somewhere between the other tabs.
void setEnabled(bool enabled) override
Enables or disables the widget.
void load(const std::unique_ptr< DataIO::Node > &node, const LoadingRenderersMap &renderers) override
Loads the widget from a tree of nodes.
std::shared_ptr< const Tabs > ConstPtr
Shared constant widget pointer.
Definition: Tabs.hpp:46
static Tabs::Ptr copy(Tabs::ConstPtr tab)
Makes a copy of another tab.
Signal & getSignal(std::string signalName) override
Retrieves a signal based on its name.
TabsRenderer * getSharedRenderer()
Returns the renderer, which gives access to functions that determine how the widget is displayed.
float getMinimumTabWidth() const
Returns the minimum tab width of the tabs.
void setMaximumTabWidth(float maximumWidth)
Changes the maximum tab width of the tabs.
bool mouseOnWidget(Vector2f pos) const override
Returns whether the mouse position (which is relative to the parent widget) lies on top of the widget...
bool remove(std::size_t index)
Removes a tab with a given index.
sf::String getText(std::size_t index) const
Gets the text of one of the tabs.
void deselect()
Deselects the selected tab.
void setTabHeight(float height)
Changes the height of the tabs.
void setMinimumTabWidth(float minimumWidth)
Changes the minimum tab width of the tabs.
void setSize(const Layout2d &size) override
Changes the area used by the tabs.
int getSelectedIndex() const
Gets the index of the currently selected tab.
Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
Definition: Tabs.hpp:467
bool remove(const sf::String &text)
Removes a tab with a given text.
bool getAutoSize() const
Returns whether the tabs are auto-sized or not.
void draw(sf::RenderTarget &target, sf::RenderStates states) const override
Draw the widget to a render target.
std::size_t getTabsCount() const
Returns the amount of tabs.
bool changeText(std::size_t index, const sf::String &text)
Changes the text of one of the tabs.
std::unique_ptr< DataIO::Node > save(SavingRenderersMap &renderers) const override
Saves the widget as a tree node in order to save it to a file.
void removeAll()
Removes all tabs.
void setTabVisible(std::size_t index, bool visible)
Changes whether a tab is visible.
void setTextSize(unsigned int size) override
Changes the character size of the text.
bool select(const sf::String &text)
Selects the tab with a given text.
std::shared_ptr< Tabs > Ptr
Shared widget pointer.
Definition: Tabs.hpp:45
std::size_t add(const sf::String &text, bool select=true)
Adds a new tab.
bool getTabVisible(std::size_t index) const
Returns whether the tab is shown or hidden.
float getMaximumTabWidth() const
Returns the maximum tab width of the tabs.
void rendererChanged(const std::string &property) override
Function called when one of the properties of the renderer is changed.
Definition: Vector2f.hpp:39
Namespace that contains all TGUI functions and classes.
Definition: AbsoluteOrRelativeValue.hpp:37