30#include <TGUI/Container.hpp>
31#include <SFML/Graphics/RenderWindow.hpp>
54#if SFML_VERSION_MAJOR == 2 && SFML_VERSION_MINOR < 5
63 Gui(sf::RenderWindow& window);
74 Gui(sf::RenderTarget& target);
80 Gui(
const Gui& copy) =
delete;
86 Gui& operator=(
const Gui& right) =
delete;
88#if SFML_VERSION_MAJOR == 2 && SFML_VERSION_MINOR < 5
95 void setTarget(sf::RenderWindow& window);
148#ifndef TGUI_REMOVE_DEPRECATED_CODE
152 TGUI_DEPRECATED(
"Use setTabKeyUsageEnabled instead") void enableTabKeyUsage();
158 TGUI_DEPRECATED("Use setTabKeyUsageEnabled instead")
void disableTabKeyUsage();
220#ifndef TGUI_REMOVE_DEPRECATED_CODE
227 TGUI_DEPRECATED(
"Use getWidgets() and Widget::getWidgetName instead") const std::vector<sf::
String> getWidgetNames() const;
273 typename T::Ptr
get(
const sf::String& widgetName)
const
275 return m_container->get<T>(widgetName);
341#ifndef TGUI_REMOVE_DEPRECATED_CODE
351 TGUI_DEPRECATED(
"Use Widget::setWidgetName instead") bool setWidgetName(const
Widget::Ptr& widget, const std::
string& name);
362 TGUI_DEPRECATED("Use
Widget::getWidgetName instead") std::
string getWidgetName(const
Widget::Ptr& widget) const;
547 bool updateTime(
const sf::Time& elapsedTime);
566 sf::RenderTarget* m_target;
567 bool m_windowFocused =
true;
569 #if SFML_VERSION_MAJOR == 2 && SFML_VERSION_MINOR < 5
571 bool m_accessToWindow;
575 GuiContainer::Ptr m_container = std::make_shared<GuiContainer>();
578 sf::Time m_tooltipTime;
579 bool m_tooltipPossible =
false;
582 sf::View m_view{{0, 0, 1, 1}};
584 bool m_drawUpdatesTime =
true;
585 bool m_TabKeyUsageEnabled =
true;
Gui class.
Definition: Gui.hpp:43
Widget::Ptr get(const sf::String &widgetName) const
Returns a pointer to an earlier created widget.
std::size_t moveWidgetForward(const Widget::Ptr &widget)
Places a widget one step forward in the z-order.
unsigned int getTextSize() const
Returns the character size for future child widgets (and for existing widgets where the size wasn't c...
std::size_t moveWidgetBackward(const Widget::Ptr &widget)
Places a widget one step backward in the z-order.
void draw()
Draws all the widgets that were added to the gui.
void moveWidgetToFront(const Widget::Ptr &widget)
Places a widget before all other widgets, to the front of the z-order.
GuiContainer::Ptr getContainer() const
Returns the internal container of the Gui.
void setTextSize(unsigned int size)
Changes the character size of all existing and future child widgets.
Widget::Ptr getFocusedChild() const
Returns the child widget that is focused inside this container.
bool focusNextWidget(bool recursive=true)
Focuses the next widget in the gui.
Widget::Ptr getWidgetBelowMouseCursor(sf::Vector2i mousePos) const
Returns the leaf child widget below the mouse.
void setTabKeyUsageEnabled(bool enabled)
When the tab key usage is enabled, pressing tab will focus another widget.
void moveWidgetToBack(const Widget::Ptr &widget)
Places a widget behind all other widgets, to the back of the z-order.
void setFont(const Font &font)
Changes the global font.
const sf::View & getView() const
Returns the view that is currently used by the gui.
Gui()
Default constructor.
void loadWidgetsFromFile(const std::string &filename, bool replaceExisting=true)
Loads the child widgets from a text file.
bool handleEvent(sf::Event event)
Passes the event to the widgets.
void setOpacity(float opacity)
Changes the opacity of all widgets.
T::Ptr get(const sf::String &widgetName) const
Returns a pointer to an earlier created widget.
Definition: Gui.hpp:273
float getOpacity() const
Returns the opacity of all the widgets.
void saveWidgetsToFile(const std::string &filename)
Saves the child widgets to a text file.
bool focusPreviousWidget(bool recursive=true)
Focuses the previous widget in the gui.
bool updateTime()
Updates the internal clock (for animations and blinking edit cursors)
Widget::Ptr getWidgetAtPosition(sf::Vector2f pos) const
Returns the leaf child widget that is located at the given position.
void unfocusAllWidgets()
Unfocus all the widgets.
bool isTabKeyUsageEnabled() const
Returns whether the tab key usage is enabled (if so, pressing tab will focus another widget)
void add(const Widget::Ptr &widgetPtr, const sf::String &widgetName="")
Adds a widget to the container.
Gui(sf::RenderTarget &target)
Constructs the gui and set the target on which the gui should be drawn.
Widget::Ptr getFocusedLeaf() const
Returns the leaf child widget that is focused inside this container.
std::shared_ptr< sf::Font > getFont() const
Returns the global font.
void setView(const sf::View &view)
Changes the view that is used by the gui.
void uncheckRadioButtons()
Unchecks all the radio buttons.
void saveWidgetsToStream(std::stringstream &stream) const
Saves this the child widgets to a text file.
sf::RenderTarget * getTarget() const
Returns the render target on which the gui is being drawn.
void loadWidgetsFromStream(std::stringstream &stream, bool replaceExisting=true)
Loads the child widgets from a string stream.
void loadWidgetsFromStream(std::stringstream &&stream, bool replaceExisting=true)
Loads the child widgets from a string stream.
bool remove(const Widget::Ptr &widget)
Removes a single widget that was added to the container.
void setTarget(sf::RenderTarget &target)
Sets the target on which the gui should be drawn.
void setDrawingUpdatesTime(bool drawUpdatesTime)
Sets whether drawing the gui will automatically update the internal clock or whether the user does it...
const std::vector< Widget::Ptr > & getWidgets() const
Returns a list of all the widgets.
void removeAllWidgets()
Removes all widgets that were added to the container.
Wrapper class to store strings.
Definition: String.hpp:119
Definition: Vector2f.hpp:39
Namespace that contains all TGUI functions and classes.
Definition: AbsoluteOrRelativeValue.hpp:37