Spinning Topp Logo BlackTopp Studios
inc
stackbutton.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 _uistackbutton_h
41 #define _uistackbutton_h
42 
43 #include "UI/button.h"
44 
45 namespace Mezzanine
46 {
47  namespace UI
48  {
49  class StackedContainer;
50  ///////////////////////////////////////////////////////////////////////////////
51  /// @brief This is a button with additional data used to track the binding to a StackedContainer which can be serialized.
52  /// @details This class does not use a LayoutStrategy.
53  ///////////////////////////////////////
54  class StackButton : public Button
55  {
56  public:
57  /// @brief String containing the type name for this class: "StackButton".
58  static const String TypeName;
59  protected:
60  /// @internal
61  /// @brief A pointer storing the StackedContainer this button is bound to.
63  public:
64  /// @brief Blank constructor.
65  /// @param Parent The parent Screen that created this widget.
66  StackButton(Screen* Parent);
67  /// @brief Standard initialization constructor.
68  /// @param RendName The name to be given to this renderable.
69  /// @param Parent The parent Screen that created this widget.
70  StackButton(const String& RendName, Screen* Parent);
71  /// @brief Rect constructor.
72  /// @param RendName The name to be given to this renderable.
73  /// @param RendRect The rect describing this widget's transform relative to it's parent.
74  /// @param Parent The parent screen that created this renderable.
75  StackButton(const String& RendName, const UnifiedRect& RendRect, Screen* Parent);
76  /// @brief XML constructor.
77  /// @param XMLNode The node of the xml document to construct from.
78  /// @param Parent The screen the created Button will belong to.
79  StackButton(const XML::Node& XMLNode, Screen* Parent);
80  /// @brief Standard destructor.
81  virtual ~StackButton();
82  //public:
83  ///////////////////////////////////////////////////////////////////////////////
84  // Utility Methods
85 
86  /// @brief Gets the container that is currently bound to this button.
87  /// @return Returns a pointer to the StackedContainer currently bound to this button.
88  virtual StackedContainer* GetBoundContainer() const;
89 
90  /// @copydoc Widget::GetTypeName() const
91  virtual const String& GetTypeName() const;
92 
93  ///////////////////////////////////////////////////////////////////////////////
94  // Serialization
95 
96  /// @copydoc Renderable::ProtoSerializeProperties(XML::Node&) const
97  virtual void ProtoSerializeProperties(XML::Node& SelfRoot) const;
98  /// @copydoc Renderable::ProtoDeSerializeProperties(const XML::Node&)
99  virtual void ProtoDeSerializeProperties(const XML::Node& SelfRoot);
100 
101  /// @copydoc Renderable::GetSerializableName()
102  static String GetSerializableName();
103 
104  ///////////////////////////////////////////////////////////////////////////////
105  // Internal Event Methods
106 
107  /// @copydoc Button::_OnActivate()
108  virtual void _OnActivate();
109  /// @copydoc Button::_OnDeactivate()
110  virtual void _OnDeactivate();
111 
112  ///////////////////////////////////////////////////////////////////////////////
113  // Internal Methods
114 
115  /// @internal
116  /// @brief Notifies this StackButton that a StackedContainer has been bound to it.
117  /// @param ToBeBound A pointer to the StackedContainer that this StackButton will be bound to.
118  virtual void _SetBoundContainer(StackedContainer* ToBeBound);
119  };//StackButton
120 
121  ///////////////////////////////////////////////////////////////////////////////
122  /// @brief This is the factory implementation for StackButton widgets.
123  /// @details
124  ///////////////////////////////////////
126  {
127  public:
128  /// @brief Class constructor.
130  /// @brief Class destructor.
131  virtual ~StackButtonFactory() { }
132 
133  /// @copydoc WidgetFactory::GetWidgetTypeName() const
134  virtual String GetWidgetTypeName() const;
135 
136  /// @brief Creates a new StackButton.
137  /// @param RendName The name to be given to the created StackButton.
138  /// @param Parent The screen the created StackButton will belong to.
139  /// @return Returns a pointer to the created StackButton.
140  virtual StackButton* CreateStackButton(const String& RendName, Screen* Parent);
141  /// @brief Creates a new StackButton.
142  /// @param RendName The name to be given to the created StackButton.
143  /// @param RendRect The dimensions that will be assigned to the created StackButton.
144  /// @param Parent The screen the created StackButton will belong to.
145  /// @return Returns a pointer to the created StackButton.
146  virtual StackButton* CreateStackButton(const String& RendName, const UnifiedRect& RendRect, Screen* Parent);
147  /// @brief Creates a new StackButton.
148  /// @param XMLNode The node of the xml document to construct from.
149  /// @param Parent The screen the created StackButton will belong to.
150  /// @return Returns a pointer to the created StackButton.
151  virtual StackButton* CreateStackButton(const XML::Node& XMLNode, Screen* Parent);
152 
153  /// @copydoc WidgetFactory::CreateWidget(Screen*)
154  virtual Widget* CreateWidget(Screen* Parent);
155  /// @copydoc WidgetFactory::CreateWidget(const String&, const NameValuePairMap&, Screen*)
156  virtual Widget* CreateWidget(const String& RendName, const NameValuePairMap& Params, Screen* Parent);
157  /// @copydoc WidgetFactory::CreateWidget(const String&, const UnifiedRect&, const NameValuePairMap&, Screen*)
158  virtual Widget* CreateWidget(const String& RendName, const UnifiedRect& RendRect, const NameValuePairMap& Params, Screen* Parent);
159  /// @copydoc WidgetFactory::CreateWidget(const XML::Node&, Screen*)
160  virtual Widget* CreateWidget(const XML::Node& XMLNode, Screen* Parent);
161  /// @copydoc WidgetFactory::DestroyWidget(Widget*)
162  virtual void DestroyWidget(Widget* ToBeDestroyed);
163  };//StackButtonFactory
164  }//UI
165 }//Mezzanine
166 
167 #endif
static String GetSerializableName()
Get the name of the the XML tag the Renderable class will leave behind as its instances are serialize...
This is the factory implementation for StackButton widgets.
Definition: stackbutton.h:125
This is a button with additional data used to track the binding to a StackedContainer which can be se...
Definition: stackbutton.h:54
virtual void _OnDeactivate()
Self logic to be executed when this button is deactivated.
virtual void ProtoDeSerializeProperties(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the properties of this object with it...
virtual void _OnActivate()
Self logic to be executed when this button is activated.
StackButton(Screen *Parent)
Blank constructor.
Definition: stackbutton.cpp:63
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
static const String TypeName
String containing the type name for this class: "StackButton".
Definition: stackbutton.h:58
This is the base class for containers that stack their children one on top of the other...
virtual StackedContainer * GetBoundContainer() const
Gets the container that is currently bound to this button.
Definition: stackbutton.cpp:89
This is the base class for all widgets.
Definition: widget.h:126
virtual ~StackButton()
Standard destructor.
Definition: stackbutton.cpp:83
StackButtonFactory()
Class constructor.
Definition: stackbutton.h:129
StackedContainer * BoundContainer
A pointer storing the StackedContainer this button is bound to.
Definition: stackbutton.h:62
virtual const String & GetTypeName() const
Gets the type of widget this is.
Definition: stackbutton.cpp:92
#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
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
Definition: stackbutton.cpp:98
virtual void _SetBoundContainer(StackedContainer *ToBeBound)
Notifies this StackButton that a StackedContainer has been bound to it.
This class is a helper class, specifically for use as a button.
Definition: button.h:66
virtual ~StackButtonFactory()
Class destructor.
Definition: stackbutton.h:131
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