MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
verticalscrollbar.h
1 //© Copyright 2010 - 2013 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 #ifndef _uiverticalscrollbar_h
41 #define _uiverticalscrollbar_h
42 
43 #include "UI/scrollbar.h"
44 
45 namespace Mezzanine
46 {
47  namespace UI
48  {
49  ///////////////////////////////////////////////////////////////////////////////
50  /// @brief This is a scrollbar class aligned on the Y axis.
51  /// @details
52  ///////////////////////////////////////
54  {
55  public:
56  /// @brief String containing the type name for this class: "VerticalScrollbar".
57  static const String TypeName;
58  protected:
59  friend class VerticalScrollbarFactory;
60 
61  /// @internal
62  /// @brief Constructor helper function for creating a vertically aligned scrollbar.
63  /// @param ScrollStyle The button style to be applied to this scrollbar.
64  virtual void ConstructVerticalScrollbar(const UI::ScrollbarStyle& ScrollStyle);
65  /// @copydoc Scrollbar::GetUpperScollLimit() const
66  virtual Real GetUpperScrollLimit() const;
67  /// @copydoc Scrollbar::GetLowerScrollLimit() const
68  virtual Real GetLowerScrollLimit() const;
69  /// @copydoc Scrollbar::MouseScroll(const Real)
70  virtual bool MouseScroll(const Vector2& MouseDelta);
71  /// @copydoc Scrollbar::ScrollBackScroll()
72  virtual bool ScrollBackScroll(const Vector2& HitPosition);
73  /// @copydoc Scrollbar::ButtonScroll(Button*)
74  virtual bool ButtonScroll(Button* TheButton);
75  //public:
76  /// @brief Blank constructor.
77  /// @param Parent The parent screen that created this scrollbar.
78  VerticalScrollbar(Screen* Parent);
79  /// @brief Standard initialization constructor.
80  /// @param RendName The name to be given to this scrollbar.
81  /// @param Style An enum value representing how you want your scrollbar constructed. See @ref UI::ScrollbarStyle enum for more info.
82  /// @param Parent The parent screen that created this scrollbar.
83  VerticalScrollbar(const String& RendName, const UI::ScrollbarStyle& Style, Screen* Parent);
84  /// @brief Rect constructor.
85  /// @param RendName The name to be given to this scrollbar.
86  /// @param RendRect The rect describing this widget's transform relative to it's parent.
87  /// @param Style An enum value representing how you want your scrollbar constructed. See @ref UI::ScrollbarStyle enum for more info.
88  /// @param Parent The parent screen that created this scrollbar.
89  VerticalScrollbar(const String& RendName, const UnifiedRect& RendRect, const UI::ScrollbarStyle& Style, Screen* Parent);
90  /// @brief XML constructor.
91  /// @param XMLNode The node of the xml document to construct from.
92  /// @param Parent The screen the created VerticalScrollbar will belong to.
93  VerticalScrollbar(const XML::Node& XMLNode, Screen* Parent);
94  /// @brief Class destructor.
95  virtual ~VerticalScrollbar();
96  public:
97  ///////////////////////////////////////////////////////////////////////////////
98  // Utility Methods
99 
100  /// @copydoc Widget::GetTypeName() const
101  virtual const String& GetTypeName() const;
102 
103  /// @copydoc QuadRenderable::SetScrollerValue(const Real&)
104  virtual void SetScrollerValue(const Real& Value);
105  /// @copydoc QuadRenderable::GetScrollerValue() const
106  virtual Real GetScrollerValue() const;
107  /// @copydoc QuadRenderable::SetScrollerSize(const Real&)
108  virtual void SetScrollerSize(const Real& Size);
109  /// @copydoc QuadRenderable::GetScrollerSize() const
110  virtual Real GetScrollerSize() const;
111  /// @copydoc QuadRenderable::UpdateDimensions(const Rect&, const Rect&)
112  virtual void UpdateDimensions(const Rect& OldSelfRect, const Rect& NewSelfRect);
113 
114  ///////////////////////////////////////////////////////////////////////////////
115  // PageProvider Methods
116 
117  /// @copydoc PageProvider::GetMaxXPages() const
118  virtual Real GetMaxXPages() const;
119  /// @copydoc PageProvider::GetMaxYPages() const
120  virtual Real GetMaxYPages() const;
121 
122  /// @copydoc PageProvider::GetCurrentXPage() const
123  virtual Real GetCurrentXPage() const;
124  /// @copydoc PageProvider::GetCurrentYPage() const
125  virtual Real GetCurrentYPage() const;
126 
127  ///////////////////////////////////////////////////////////////////////////////
128  // Serialization
129 
130  /// @copydoc QuadRenderable::ProtoSerializeChildQuads(XML::Node&) const
131  virtual void ProtoSerializeChildQuads(XML::Node& SelfRoot) const;
132  /// @copydoc QuadRenderable::ProtoDeSerializeChildQuads(const XML::Node&)
133  virtual void ProtoDeSerializeChildQuads(const XML::Node& SelfRoot);
134 
135  /// @copydoc Renderable::GetSerializableName()
136  static String GetSerializableName();
137 
138  ///////////////////////////////////////////////////////////////////////////////
139  // Internal Methods
140 
141  /// @copydoc PageProvider::_NotifyContainerUpdated()
142  virtual void _NotifyContainerUpdated();
143  };//VerticalScrollbar
144 
145  ///////////////////////////////////////////////////////////////////////////////
146  /// @brief This is the factory implementation for VerticalScrollbar widgets.
147  /// @details
148  ///////////////////////////////////////
150  {
151  public:
152  /// @brief Class constructor.
154  /// @brief Class destructor.
156 
157  /// @copydoc WidgetFactory::GetWidgetTypeName() const
158  virtual String GetWidgetTypeName() const;
159 
160  /// @brief Creates a new VerticalScrollbar.
161  /// @param RendName The name to be given to the created VerticalScrollbar.
162  /// @param Style An enum value representing how to position the button layout of the scrollbar. See @ref UI::ScrollbarStyle enum for more info.
163  /// @param Parent The screen the created VerticalScrollbar will belong to.
164  /// @return Returns a pointer to the created VerticalScrollbar.
165  virtual VerticalScrollbar* CreateVerticalScrollbar(const String& RendName, const UI::ScrollbarStyle& Style, Screen* Parent);
166  /// @brief Creates a new VerticalScrollbar.
167  /// @param RendName The name to be given to the created VerticalScrollbar.
168  /// @param RendRect The dimensions that will be assigned to the created VerticalScrollbar.
169  /// @param Style An enum value representing how to position the button layout of the scrollbar. See @ref UI::ScrollbarStyle enum for more info.
170  /// @param Parent The screen the created VerticalScrollbar will belong to.
171  /// @return Returns a pointer to the created VerticalScrollbar.
172  virtual VerticalScrollbar* CreateVerticalScrollbar(const String& RendName, const UnifiedRect& RendRect, const UI::ScrollbarStyle& Style, Screen* Parent);
173  /// @brief Creates a new VerticalScrollbar.
174  /// @param XMLNode The node of the xml document to construct from.
175  /// @param Parent The screen the created VerticalScrollbar will belong to.
176  /// @return Returns a pointer to the created VerticalScrollbar.
177  virtual VerticalScrollbar* CreateVerticalScrollbar(const XML::Node& XMLNode, Screen* Parent);
178 
179  /// @copydoc WidgetFactory::CreateWidget(Screen*)
180  virtual Widget* CreateWidget(Screen* Parent);
181  /// @copydoc WidgetFactory::CreateWidget(const String&, const NameValuePairMap&, Screen*)
182  virtual Widget* CreateWidget(const String& RendName, const NameValuePairMap& Params, Screen* Parent);
183  /// @copydoc WidgetFactory::CreateWidget(const String&, const UnifiedRect&, const NameValuePairMap&, Screen*)
184  virtual Widget* CreateWidget(const String& RendName, const UnifiedRect& RendRect, const NameValuePairMap& Params, Screen* Parent);
185  /// @copydoc WidgetFactory::CreateWidget(const XML::Node&, Screen*)
186  virtual Widget* CreateWidget(const XML::Node& XMLNode, Screen* Parent);
187  /// @copydoc WidgetFactory::DestroyWidget(Widget*)
188  virtual void DestroyWidget(Widget* ToBeDestroyed);
189  };//VerticalScrollbarFactory
190  }//UI
191 }//Mezzanine
192 
193 #endif