26#ifndef TGUI_CHILD_WINDOW_HPP 
   27#define TGUI_CHILD_WINDOW_HPP 
   30#include <TGUI/CopiedSharedPtr.hpp> 
   31#include <TGUI/Container.hpp> 
   32#include <TGUI/Widgets/Button.hpp> 
   33#include <TGUI/Renderers/ChildWindowRenderer.hpp> 
   47        typedef std::shared_ptr<ChildWindow> 
Ptr; 
 
   48        typedef std::shared_ptr<const ChildWindow> 
ConstPtr; 
 
   72        ChildWindow(
const sf::String& title = 
"", 
unsigned int titleButtons = TitleButton::Close);
 
  359        void setParent(
Container* parent) 
override;
 
  373        void leftMousePressed(
Vector2f pos) 
override;
 
  378        void leftMouseReleased(
Vector2f pos) 
override;
 
  383        void rightMousePressed(
Vector2f pos) 
override;
 
  388        void rightMouseReleased(
Vector2f pos) 
override;
 
  393        void mouseMoved(
Vector2f pos) 
override;
 
  398        void keyPressed(
const sf::Event::KeyEvent& event) 
override;
 
  403        void mouseNoLongerOnWidget() 
override;
 
  408        void leftMouseButtonNoLongerDown() 
override;
 
  418        void draw(sf::RenderTarget& target, sf::RenderStates states) 
const override;
 
  427        void updateTitleBarHeight();
 
  454        std::unique_ptr<DataIO::Node> 
save(SavingRenderersMap& renderers) 
const override;
 
  460        void load(
const std::unique_ptr<DataIO::Node>& node, 
const LoadingRenderersMap& renderers) 
override;
 
  468            return std::make_shared<ChildWindow>(*
this);
 
  499        Vector2f       m_draggingPosition;
 
  500        Vector2f       m_maximumSize    = {std::numeric_limits<float>::infinity(), std::numeric_limits<float>::infinity()};
 
  501        Vector2f       m_minimumSize    = {0, 0};
 
  502        TitleAlignment m_titleAlignment = TitleAlignment::Center;
 
  503        unsigned int   m_titleButtons   = TitleButton::Close;
 
  504        unsigned int   m_titleTextSize  = 0;
 
  506        CopiedSharedPtr<Button> m_closeButton;
 
  507        CopiedSharedPtr<Button> m_minimizeButton;
 
  508        CopiedSharedPtr<Button> m_maximizeButton;
 
  510        bool m_mouseDownOnTitleBar = 
false;
 
  511        bool m_keepInParent = 
false;
 
  513        bool m_positionLocked = 
false;
 
  514        bool m_resizable = 
false;
 
  515        int m_resizeDirection = ResizeNone;
 
  517        Sprite m_spriteTitleBar;
 
  518        Sprite m_spriteBackground;
 
  521        Borders m_bordersCached;
 
  522        Color   m_borderColorCached;
 
  523        Color   m_borderColorFocusedCached;
 
  524        Color   m_titleColorCached;
 
  525        Color   m_titleBarColorCached;
 
  526        Color   m_backgroundColorCached;
 
  527        float   m_titleBarHeightCached = 20;
 
  528        float   m_borderBelowTitleBarCached = 0;
 
  529        float   m_distanceToSideCached = 0;
 
  530        float   m_paddingBetweenButtonsCached = 0;
 
  531        float   m_minimumResizableBorderWidthCached = 5;
 
  532        bool    m_showTextOnTitleButtonsCached = 
false;
 
Definition: ChildWindowRenderer.hpp:37
 
Child window widget.
Definition: ChildWindow.hpp:44
 
ChildWindowRenderer * getSharedRenderer()
Returns the renderer, which gives access to functions that determine how the widget is displayed.
 
void setPositionLocked(bool positionLocked=true)
Changes whether the child window can be moved by dragging its title bar or not.
 
TitleAlignment
Title alignments, possible options for the setTitleAlignment function.
Definition: ChildWindow.hpp:53
 
unsigned int getTitleTextSize() const
Returns the character size of the title.
 
const sf::String & getTitle() const
Returns the title that is displayed in the title bar of the child window.
 
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.
 
Vector2f getFullSize() const override
Returns the size of the full child window.
 
void setPosition(const Layout2d &position) override
Sets the position of the widget.
 
std::shared_ptr< ChildWindow > Ptr
Shared widget pointer.
Definition: ChildWindow.hpp:47
 
Vector2f getMaximumSize() const
Returns the maximum size of the child window.
 
void setTitleButtons(unsigned int buttons)
Changes the title buttons.
 
void setTitleTextSize(unsigned int size)
Changes the character size of the title.
 
void setTitleAlignment(TitleAlignment alignment)
Changes the title alignment.
 
Vector2f getChildWidgetsOffset() const override
Returns the distance between the position of the container and a widget that would be drawn inside th...
 
TitleAlignment getTitleAlignment() const
Returns the title alignment.
 
void setTitle(const sf::String &title)
Changes the title that is displayed in the title bar of the child window.
 
bool isPositionLocked() const
Checks whether the child window can be moved by dragging its title bar or not.
 
TitleButton
Title buttons (use bitwise OR to combine)
Definition: ChildWindow.hpp:62
 
static ChildWindow::Ptr create(const sf::String &title="", unsigned int titleButtons=TitleButton::Close)
Creates a new child window widget.
 
void setMinimumSize(Vector2f size)
Sets the minimum size of the child window.
 
void destroy()
Destroys the window.
 
void setMaximumSize(Vector2f size)
Sets the maximum size of the child window.
 
ChildWindowRenderer * getRenderer()
Returns the renderer, which gives access to functions that determine how the widget is displayed.
 
bool mouseOnWidget(Vector2f pos) const override
Returns whether the mouse position (which is relative to the parent widget) lies on top of the widget...
 
Signal & getSignal(std::string signalName) override
Retrieves a signal based on its name.
 
void load(const std::unique_ptr< DataIO::Node > &node, const LoadingRenderersMap &renderers) override
Loads the widget from a tree of nodes.
 
void draw(sf::RenderTarget &target, sf::RenderStates states) const override
Draw the widget to a render target.
 
std::shared_ptr< const ChildWindow > ConstPtr
Shared constant widget pointer.
Definition: ChildWindow.hpp:48
 
void setKeepInParent(bool enabled=true)
Sets the child window to be kept inside its parent.
 
unsigned int getTitleButtons() const
Returns the title bar buttons.
 
bool isKeptInParent() const
Tells whether the child window is kept inside its parent.
 
Vector2f getMinimumSize() const
Returns the minimum size of the child window.
 
void close()
Try to close the window.
 
void setResizable(bool resizable=true)
Changes whether the child window can be resized by dragging its borders or not.
 
bool isResizable() const
Checks whether the child window can be resized by dragging its borders or not.
 
Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
Definition: ChildWindow.hpp:466
 
void setSize(const Layout2d &size) override
Changes the size of the child window.
 
static ChildWindow::Ptr copy(ChildWindow::ConstPtr childWindow)
Makes a copy of another child window.
 
void rendererChanged(const std::string &property) override
Function called when one of the properties of the renderer is changed.
 
Container widget.
Definition: Container.hpp:48
 
Class to store the position or size of a widget.
Definition: Layout.hpp:260
 
Signal to which the user can subscribe to get callbacks from.
Definition: Signal.hpp:513
 
Signal to which the user can subscribe to get callbacks from.
Definition: Signal.hpp:231
 
Definition: Vector2f.hpp:39
 
Namespace that contains all TGUI functions and classes.
Definition: AbsoluteOrRelativeValue.hpp:37