MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
verticalcontainer.h
1 //© Copyright 2010 - 2012 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 _uiverticalcontainer_h
42 #define _uiverticalcontainer_h
43 
44 #include "UI/linearcontainer.h"
45 
46 namespace Mezzanine
47 {
48  namespace UI
49  {
50  class VerticalScrollbar;
51  class Spinner;
52  ///////////////////////////////////////////////////////////////////////////////
53  /// @brief A layout container that aligns it's children along a common Y axis.
54  /// @details
55  ///////////////////////////////////////
57  {
58  public:
59  /// @brief String containing the type name for this class: "VerticalContainer".
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  VerticalContainer(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  VerticalContainer(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  VerticalContainer(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 VerticalContainer will belong to.
80  VerticalContainer(const XML::Node& XMLNode, Screen* Parent);
81  /// @brief Class destructor.
82  virtual ~VerticalContainer();
83 
84  ///////////////////////////////////////////////////////////////////////////////
85  // Utility
86 
87  /// @copydoc Widget::GetTypeName() const
88  virtual const String& GetTypeName() const;
89 
90  /// @copydoc PagedContainer::SetProviders(PageProvider*, PageProvider*)
91  virtual void SetProviders(PageProvider* XProv, PageProvider* YProv);
92  /// @copydoc PagedContainer::SetXProvider(PageProvider*)
93  virtual void SetXProvider(PageProvider* XProv);
94  /// @copydoc PagedContainer::SetYProvider(PageProvider*)
95  virtual void SetYProvider(PageProvider* YProv);
96 
97  /// @brief Convenience method for configuring a VerticalScrollbar as the page provider for this container.
98  /// @param Prov A pointer to the VerticalScrollbar which will determine which page this container is rendering.
99  virtual void SetScrollbarProvider(VerticalScrollbar* Prov);
100  /// @brief Convenience method for configuring a Spinner as the page provider for this container.
101  /// @param Prov A pointer to the Spinner which will determine which page this container is rendering.
102  virtual void SetSpinnerProvider(Spinner* Prov);
103 
104  ///////////////////////////////////////////////////////////////////////////////
105  // Child Management
106 
107  ///////////////////////////////////////////////////////////////////////////////
108  // Serialization
109 
110  /// @copydoc Renderable::ProtoSerializeProperties(XML::Node&) const
111  virtual void ProtoSerializeProperties(XML::Node& SelfRoot) const;
112  /// @copydoc Renderable::ProtoDeSerializeProperties(const XML::Node&)
113  virtual void ProtoDeSerializeProperties(const XML::Node& SelfRoot);
114 
115  /// @copydoc Renderable::GetSerializableName()
116  static String GetSerializableName();
117 
118  ///////////////////////////////////////////////////////////////////////////////
119  // Internal Methods
120  };//VerticalContainer
121 
122  ///////////////////////////////////////////////////////////////////////////////
123  /// @brief This is the factory implementation for VerticalContainer widgets.
124  /// @details
125  ///////////////////////////////////////
127  {
128  public:
129  /// @brief Class constructor.
131  /// @brief Class destructor.
133 
134  /// @copydoc WidgetFactory::GetWidgetTypeName() const
135  virtual String GetWidgetTypeName() const;
136 
137  /// @brief Creates a new VerticalContainer.
138  /// @param RendName The name to be given to the created VerticalContainer.
139  /// @param Parent The screen the created VerticalContainer will belong to.
140  /// @return Returns a pointer to the created VerticalContainer.
141  virtual VerticalContainer* CreateVerticalContainer(const String& RendName, Screen* Parent);
142  /// @brief Creates a new VerticalContainer.
143  /// @param RendName The name to be given to the created VerticalContainer.
144  /// @param RendRect The dimensions that will be assigned to the created VerticalContainer.
145  /// @param Parent The screen the created VerticalContainer will belong to.
146  /// @return Returns a pointer to the created VerticalContainer.
147  virtual VerticalContainer* CreateVerticalContainer(const String& RendName, const UnifiedRect& RendRect, Screen* Parent);
148  /// @brief Creates a new VerticalContainer.
149  /// @param XMLNode The node of the xml document to construct from.
150  /// @param Parent The screen the created VerticalContainer will belong to.
151  /// @return Returns a pointer to the created VerticalContainer.
152  virtual VerticalContainer* CreateVerticalContainer(const XML::Node& XMLNode, Screen* Parent);
153 
154  /// @copydoc WidgetFactory::CreateWidget(Screen*)
155  virtual Widget* CreateWidget(Screen* Parent);
156  /// @copydoc WidgetFactory::CreateWidget(const String&, const NameValuePairMap&, Screen*)
157  virtual Widget* CreateWidget(const String& RendName, const NameValuePairMap& Params, Screen* Parent);
158  /// @copydoc WidgetFactory::CreateWidget(const String&, const UnifiedRect&, const NameValuePairMap&, Screen*)
159  virtual Widget* CreateWidget(const String& RendName, const UnifiedRect& RendRect, const NameValuePairMap& Params, Screen* Parent);
160  /// @copydoc WidgetFactory::CreateWidget(const XML::Node&, Screen*)
161  virtual Widget* CreateWidget(const XML::Node& XMLNode, Screen* Parent);
162  /// @copydoc WidgetFactory::DestroyWidget(Widget*)
163  virtual void DestroyWidget(Widget* ToBeDestroyed);
164  };//VerticalContainerFactory
165  }//UI
166 }//Mezzanine
167 
168 #endif