Spinning Topp Logo BlackTopp Studios
inc
horizontalcontainer.h
1 // © Copyright 2010 - 2016 BlackTopp Studios Inc.
2 /* This file is part of The Mezzanine Engine.
3 
4  The Mezzanine Engine is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  The Mezzanine Engine is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with The Mezzanine Engine. If not, see <http://www.gnu.org/licenses/>.
16 */
17 /* The original authors have included a copy of the license specified above in the
18  'Docs' folder. See 'gpl.txt'
19 */
20 /* We welcome the use of the Mezzanine engine to anyone, including companies who wish to
21  Build professional software and charge for their product.
22 
23  However there are some practical restrictions, so if your project involves
24  any of the following you should contact us and we will try to work something
25  out:
26  - DRM or Copy Protection of any kind(except Copyrights)
27  - Software Patents You Do Not Wish to Freely License
28  - Any Kind of Linking to Non-GPL licensed Works
29  - Are Currently In Violation of Another Copyright Holder's GPL License
30  - If You want to change our code and not add a few hundred MB of stuff to
31  your distribution
32 
33  These and other limitations could cause serious legal problems if you ignore
34  them, so it is best to simply contact us or the Free Software Foundation, if
35  you have any questions.
36 
37  Joseph Toppi - toppij@gmail.com
38  John Blackwood - makoenergy02@gmail.com
39 */
40 
41 #ifndef _uihorizontalcontainer_h
42 #define _uihorizontalcontainer_h
43 
44 #include "UI/linearcontainer.h"
45 
46 namespace Mezzanine
47 {
48  namespace UI
49  {
50  class HorizontalScrollbar;
51  class Spinner;
52  ///////////////////////////////////////////////////////////////////////////////
53  /// @brief A layout container that aligns it's children along a common X axis.
54  /// @details This class uses a HorizontalLayoutStrategy.
55  ///////////////////////////////////////
57  {
58  public:
59  /// @brief String containing the type name for this class: "HorizontalContainer".
60  static const String TypeName;
61  protected:
62  /// @copydoc LayoutContainer::UpdateContainerDimensionsImpl(const Rect&, const Rect&)
63  virtual void UpdateContainerDimensionsImpl(const Rect& OldSelfRect, const Rect& NewSelfRect);
64  public:
65  /// @brief Blank constructor.
66  /// @param Parent The parent Screen that created this widget.
67  HorizontalContainer(Screen* Parent);
68  /// @brief Standard initialization constructor.
69  /// @param RendName The name to be given to this renderable.
70  /// @param Parent The parent Screen that created this widget.
71  HorizontalContainer(const String& RendName, Screen* Parent);
72  /// @brief Rect constructor.
73  /// @param RendName The name to be given to this renderable.
74  /// @param RendRect The rect describing this widget's transform relative to it's parent.
75  /// @param Parent The parent screen that created this renderable.
76  HorizontalContainer(const String& RendName, const UnifiedRect& RendRect, Screen* Parent);
77  /// @brief XML constructor.
78  /// @param XMLNode The node of the xml document to construct from.
79  /// @param Parent The screen the created HorizontalContainer will belong to.
80  HorizontalContainer(const XML::Node& XMLNode, Screen* Parent);
81  /// @brief Class destructor.
82  virtual ~HorizontalContainer();
83 
84  ///////////////////////////////////////////////////////////////////////////////
85  // Utility
86 
87  /// @copydoc PagedContainer::UpdateWorkAreaSize()
88  virtual void UpdateWorkAreaSize();
89  /// @copydoc PagedContainer::QuickUpdateWorkAreaSize(const UnifiedVec2&, Boole)
90  virtual void QuickUpdateWorkAreaSize(const UnifiedVec2& ChildSize, Boole Adding);
91 
92  /// @copydoc Widget::GetTypeName() const
93  virtual const String& GetTypeName() const;
94 
95  /// @copydoc PagedContainer::SetProviders(PageProvider*, PageProvider*)
96  virtual void SetProviders(PageProvider* XProv, PageProvider* YProv);
97  /// @copydoc PagedContainer::SetXProvider(PageProvider*)
98  virtual void SetXProvider(PageProvider* XProv);
99  /// @copydoc PagedContainer::SetYProvider(PageProvider*)
100  virtual void SetYProvider(PageProvider* YProv);
101 
102  /// @brief Convenience method for configuring a HorizontalScrollbar as the page provider for this container.
103  /// @param Prov A pointer to the HorizontalScrollbar which will determine which page this container is rendering.
104  virtual void SetScrollbarProvider(HorizontalScrollbar* Prov);
105  /// @brief Convenience method for configuring a Spinner as the page provider for this container.
106  /// @param Prov A pointer to the Spinner which will determine which page this container is rendering.
107  virtual void SetSpinnerProvider(Spinner* Prov);
108 
109  ///////////////////////////////////////////////////////////////////////////////
110  // Child Management
111 
112  ///////////////////////////////////////////////////////////////////////////////
113  // Serialization
114 
115  /// @copydoc Renderable::ProtoSerializeProperties(XML::Node&) const
116  virtual void ProtoSerializeProperties(XML::Node& SelfRoot) const;
117  /// @copydoc Renderable::ProtoDeSerializeProperties(const XML::Node&)
118  virtual void ProtoDeSerializeProperties(const XML::Node& SelfRoot);
119 
120  /// @copydoc Renderable::GetSerializableName()
121  static String GetSerializableName();
122 
123  ///////////////////////////////////////////////////////////////////////////////
124  // Internal Methods
125  };//HorizontalContainer
126 
127  ///////////////////////////////////////////////////////////////////////////////
128  /// @brief This is the factory implementation for HorizontalContainer widgets.
129  /// @details
130  ///////////////////////////////////////
132  {
133  public:
134  /// @brief Class constructor.
136  /// @brief Class destructor.
138 
139  /// @copydoc WidgetFactory::GetWidgetTypeName() const
140  virtual String GetWidgetTypeName() const;
141 
142  /// @brief Creates a new HorizontalContainer.
143  /// @param RendName The name to be given to the created HorizontalContainer.
144  /// @param Parent The screen the created HorizontalContainer will belong to.
145  /// @return Returns a pointer to the created HorizontalContainer.
146  virtual HorizontalContainer* CreateHorizontalContainer(const String& RendName, Screen* Parent);
147  /// @brief Creates a new HorizontalContainer.
148  /// @param RendName The name to be given to the created HorizontalContainer.
149  /// @param RendRect The dimensions that will be assigned to the created HorizontalContainer.
150  /// @param Parent The screen the created HorizontalContainer will belong to.
151  /// @return Returns a pointer to the created HorizontalContainer.
152  virtual HorizontalContainer* CreateHorizontalContainer(const String& RendName, const UnifiedRect& RendRect, Screen* Parent);
153  /// @brief Creates a new HorizontalContainer.
154  /// @param XMLNode The node of the xml document to construct from.
155  /// @param Parent The screen the created HorizontalContainer will belong to.
156  /// @return Returns a pointer to the created HorizontalContainer.
157  virtual HorizontalContainer* CreateHorizontalContainer(const XML::Node& XMLNode, Screen* Parent);
158 
159  /// @copydoc WidgetFactory::CreateWidget(Screen*)
160  virtual Widget* CreateWidget(Screen* Parent);
161  /// @copydoc WidgetFactory::CreateWidget(const String&, const NameValuePairMap&, Screen*)
162  virtual Widget* CreateWidget(const String& RendName, const NameValuePairMap& Params, Screen* Parent);
163  /// @copydoc WidgetFactory::CreateWidget(const String&, const UnifiedRect&, const NameValuePairMap&, Screen*)
164  virtual Widget* CreateWidget(const String& RendName, const UnifiedRect& RendRect, const NameValuePairMap& Params, Screen* Parent);
165  /// @copydoc WidgetFactory::CreateWidget(const XML::Node&, Screen*)
166  virtual Widget* CreateWidget(const XML::Node& XMLNode, Screen* Parent);
167  /// @copydoc WidgetFactory::DestroyWidget(Widget*)
168  virtual void DestroyWidget(Widget* ToBeDestroyed);
169  };//HorizontalContainerFactory
170  }//UI
171 }//Mezzanine
172 
173 #endif
bool Boole
Generally acts a single bit, true or false.
Definition: datatypes.h:173
This class represents a box shaped area on the screen.
Definition: rect.h:55
This is a simple widget for a numeric variable in a box.
Definition: spinner.h:130
This class represents a 2D rect which can express the size and position of a renderable on screen...
Definition: unifieddim.h:661
A light-weight handle for manipulating nodes in DOM tree.
Definition: node.h:89
This is the base class for all widgets.
Definition: widget.h:126
This is a scrollbar class aligned on the X axis.
This is the base class for interpretting widget values to page positions.
Definition: pageprovider.h:55
#define MEZZ_LIB
Some platforms require special decorations to denote what is exported/imported in a share library...
The bulk of the engine components go in this namspace.
Definition: actor.cpp:56
A layout container that aligns it's children along a common X axis.
This class represents a point in 2D space using UnifiedDim's.
Definition: unifieddim.h:306
This is the factory implementation for HorizontalContainer widgets.
std::map< String, String > NameValuePairMap
This is a datatype mostly used for describing settings or parameters that can't be declared in advanc...
Definition: datatypes.h:209
This class is a helper class for creating UI's. It is responsible for storing and keeping track of al...
Definition: screen.h:142
std::string String
A datatype used to a series of characters.
Definition: datatypes.h:159
static const String TypeName
String containing the type name for this class: "HorizontalContainer".
This is a base class for factories that construct the widgets available to the UI subsystem...
Definition: widgetfactory.h:61
This is a container class for placing child objects in succession on a single axis.
virtual ~HorizontalContainerFactory()
Class destructor.