Spinning Topp Logo BlackTopp Studios
inc
horizontalscrollbar.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 #ifndef _uihorizontalscrollbar_h
41 #define _uihorizontalscrollbar_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 X axis.
51  /// @details This class uses a HorizontalLayoutStrategy.
52  ///////////////////////////////////////
54  {
55  public:
56  /// @brief String containing the type name for this class: "HorizontalScrollbar".
57  static const String TypeName;
58  protected:
59  /// @internal
60  /// @brief Constructor helper function for creating a horizontally aligned scrollbar.
61  /// @param ScrollStyle The button style to be applied to this scrollbar.
62  virtual void ConstructHorizontalScrollbar(const UI::ScrollbarStyle& ScrollStyle);
63  /// @copydoc Scrollbar::GetUpperScrollLimit() const
64  virtual Real GetUpperScrollLimit() const;
65  /// @copydoc Scrollbar::GetLowerScrollLimit() const
66  virtual Real GetLowerScrollLimit() const;
67  public:
68  /// @brief Blank constructor.
69  /// @param Parent The parent screen that created this scrollbar.
70  HorizontalScrollbar(Screen* Parent);
71  /// @brief Standard initialization constructor.
72  /// @param RendName The name to be given to this scrollbar.
73  /// @param Style An enum value representing how you want your scrollbar constructed. See @ref UI::ScrollbarStyle enum for more info.
74  /// @param Parent The parent screen that created this scrollbar.
75  HorizontalScrollbar(const String& RendName, const UI::ScrollbarStyle& Style, Screen* Parent);
76  /// @brief Rect constructor.
77  /// @param RendName The name to be given to this scrollbar.
78  /// @param RendRect The rect describing this widget's transform relative to it's parent.
79  /// @param Style An enum value representing how you want your scrollbar constructed. See @ref UI::ScrollbarStyle enum for more info.
80  /// @param Parent The parent screen that created this scrollbar.
81  HorizontalScrollbar(const String& RendName, const UnifiedRect& RendRect, const UI::ScrollbarStyle& Style, Screen* Parent);
82  /// @brief XML constructor.
83  /// @param XMLNode The node of the xml document to construct from.
84  /// @param Parent The screen the created HorizontalScrollbar will belong to.
85  HorizontalScrollbar(const XML::Node& XMLNode, Screen* Parent);
86  /// @brief Class destructor.
87  virtual ~HorizontalScrollbar();
88  //public:
89  ///////////////////////////////////////////////////////////////////////////////
90  // Utility Methods
91 
92  /// @copydoc Widget::GetTypeName() const
93  virtual const String& GetTypeName() const;
94 
95  /// @copydoc Scrollbar::SetScrollerValue(const Real&)
96  virtual void SetScrollerValue(const Real& Value);
97  /// @copydoc Scrollbar::GetScrollerValue() const
98  virtual Real GetScrollerValue() const;
99  /// @copydoc Scrollbar::SetScrollerSize(const Real&)
100  virtual void SetScrollerSize(const Real& Size);
101  /// @copydoc Scrollbar::GetScrollerSize() const
102  virtual Real GetScrollerSize() const;
103  /// @copydoc QuadRenderable::UpdateDimensions(const Rect&, const Rect&)
104  virtual void UpdateDimensions(const Rect& OldSelfRect, const Rect& NewSelfRect);
105 
106  ///////////////////////////////////////////////////////////////////////////////
107  // Visibility and Priority Methods
108 
109  /// @copydoc Renderable::SetVisible(Boole)
110  virtual void SetVisible(Boole CanSee);
111  /// @copydoc Renderable::Show()
112  virtual void Show();
113  /// @copydoc Renderable::Hide()
114  virtual void Hide();
115 
116  ///////////////////////////////////////////////////////////////////////////////
117  // PageProvider Methods
118 
119  /// @copydoc PageProvider::GetMaxXPages() const
120  virtual Real GetMaxXPages() const;
121  /// @copydoc PageProvider::GetMaxYPages() const
122  virtual Real GetMaxYPages() const;
123 
124  /// @copydoc PageProvider::GetCurrentXPage() const
125  virtual Real GetCurrentXPage() const;
126  /// @copydoc PageProvider::GetCurrentYPage() const
127  virtual Real GetCurrentYPage() const;
128 
129  ///////////////////////////////////////////////////////////////////////////////
130  // Serialization
131 
132  /// @copydoc QuadRenderable::ProtoSerializeChildQuads(XML::Node&) const
133  virtual void ProtoSerializeChildQuads(XML::Node& SelfRoot) const;
134  /// @copydoc QuadRenderable::ProtoDeSerializeChildQuads(const XML::Node&)
135  virtual void ProtoDeSerializeChildQuads(const XML::Node& SelfRoot);
136 
137  /// @copydoc Renderable::GetSerializableName()
138  static String GetSerializableName();
139 
140  ///////////////////////////////////////////////////////////////////////////////
141  // Internal Methods
142 
143  /// @copydoc PageProvider::_NotifyContainerUpdated()
144  virtual void _NotifyContainerUpdated();
145  /// @copydoc Scrollbar::_MouseScroll(const Vector2&)
146  virtual Boole _MouseScroll(const Vector2& MouseDelta);
147  /// @copydoc Scrollbar::_MouseWheelScroll(const Integer)
148  virtual Boole _MouseWheelScroll(const Integer Direction);
149  /// @copydoc Scrollbar::_ScrollBackScroll(const Vector2&)
150  virtual Boole _ScrollBackScroll(const Vector2& HitPosition);
151  /// @copydoc Scrollbar::_ButtonScroll(Button*)
152  virtual Boole _ButtonScroll(Button* TheButton);
153  };//HorizontalScrollbar
154 
155  ///////////////////////////////////////////////////////////////////////////////
156  /// @brief This is the factory implementation for HorizontalScrollbar widgets.
157  /// @details
158  ///////////////////////////////////////
160  {
161  public:
162  /// @brief Class constructor.
164  /// @brief Class destructor.
166 
167  /// @copydoc WidgetFactory::GetWidgetTypeName() const
168  virtual String GetWidgetTypeName() const;
169 
170  /// @brief Creates a new HorizontalScrollbar.
171  /// @param RendName The name to be given to the created HorizontalScrollbar.
172  /// @param Style An enum value representing how to position the button layout of the scrollbar. See @ref UI::ScrollbarStyle enum for more info.
173  /// @param Parent The screen the created HorizontalScrollbar will belong to.
174  /// @return Returns a pointer to the created HorizontalScrollbar.
175  virtual HorizontalScrollbar* CreateHorizontalScrollbar(const String& RendName, const UI::ScrollbarStyle& Style, Screen* Parent);
176  /// @brief Creates a new HorizontalScrollbar.
177  /// @param RendName The name to be given to the created HorizontalScrollbar.
178  /// @param RendRect The dimensions that will be assigned to the created HorizontalScrollbar.
179  /// @param Style An enum value representing how to position the button layout of the scrollbar. See @ref UI::ScrollbarStyle enum for more info.
180  /// @param Parent The screen the created HorizontalScrollbar will belong to.
181  /// @return Returns a pointer to the created HorizontalScrollbar.
182  virtual HorizontalScrollbar* CreateHorizontalScrollbar(const String& RendName, const UnifiedRect& RendRect, const UI::ScrollbarStyle& Style, Screen* Parent);
183  /// @brief Creates a new HorizontalScrollbar.
184  /// @param XMLNode The node of the xml document to construct from.
185  /// @param Parent The screen the created HorizontalScrollbar will belong to.
186  /// @return Returns a pointer to the created HorizontalScrollbar.
187  virtual HorizontalScrollbar* CreateHorizontalScrollbar(const XML::Node& XMLNode, Screen* Parent);
188 
189  /// @copydoc WidgetFactory::CreateWidget(Screen*)
190  virtual Widget* CreateWidget(Screen* Parent);
191  /// @copydoc WidgetFactory::CreateWidget(const String&, const NameValuePairMap&, Screen*)
192  virtual Widget* CreateWidget(const String& RendName, const NameValuePairMap& Params, Screen* Parent);
193  /// @copydoc WidgetFactory::CreateWidget(const String&, const UnifiedRect&, const NameValuePairMap&, Screen*)
194  virtual Widget* CreateWidget(const String& RendName, const UnifiedRect& RendRect, const NameValuePairMap& Params, Screen* Parent);
195  /// @copydoc WidgetFactory::CreateWidget(const XML::Node&, Screen*)
196  virtual Widget* CreateWidget(const XML::Node& XMLNode, Screen* Parent);
197  /// @copydoc WidgetFactory::DestroyWidget(Widget*)
198  virtual void DestroyWidget(Widget* ToBeDestroyed);
199  };//HorizontalScrollbarFactory
200  }//UI
201 }//Mezzanine
202 
203 #endif
virtual ~HorizontalScrollbarFactory()
Class destructor.
bool Boole
Generally acts a single bit, true or false.
Definition: datatypes.h:173
This is the factory implementation for HorizontalScrollbar widgets.
int Integer
A datatype used to represent any integer close to.
Definition: datatypes.h:154
This class represents a box shaped area on the screen.
Definition: rect.h:55
ScrollbarStyle
Used by the scrollbar class to determine what styling should be used for the scrollbar.
float Real
A Datatype used to represent a real floating point number.
Definition: datatypes.h:141
This class represents a 2D rect which can express the size and position of a renderable on screen...
Definition: unifieddim.h:661
This is the scrollbar base class.
Definition: scrollbar.h:126
A light-weight handle for manipulating nodes in DOM tree.
Definition: node.h:89
This is used to represent a point on a 2 dimentional area, such as a screen.
Definition: vector2.h:63
This is the base class for all widgets.
Definition: widget.h:126
static const String TypeName
String containing the type name for this class: "HorizontalScrollbar".
This is a scrollbar class aligned on the X axis.
#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
This class is a helper class, specifically for use as a button.
Definition: button.h:66
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
This is a base class for factories that construct the widgets available to the UI subsystem...
Definition: widgetfactory.h:61