MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
dropdownlist.h
1 // © Copyright 2010 - 2014 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 _uidropdownlist_h
41 #define _uidropdownlist_h
42 
43 #include "UI/widget.h"
44 #include "uienumerations.h"
45 
46 namespace Mezzanine
47 {
48  namespace UI
49  {
50  /*class ListBox;
51  class Button;
52  ///////////////////////////////////////////////////////////////////////////////
53  /// @class DropDownList
54  /// @headerfile uidropdownlist.h
55  /// @brief A widget that displays one selection from a list that can have it's visibility toggled.
56  /// @details Note: When getting or setting either the position or size of this widget, you are altering
57  /// the caption and button only, and not the list. The list will be moved and resized appropriately, automatically.
58  ///////////////////////////////////////
59  class MEZZ_LIB DropDownList : public Widget
60  {
61  protected:
62  friend class RenderableFactory;
63  Widget* Selection;
64  Button* ListToggle;
65  UI::ListBox* SelectionList;
66  bool ToggleActivated;
67  /// @brief Internal construction function.
68  void ConstructDropDownList(const Rect& RendRect, const Whole& Glyph, const UI::ScrollbarStyle& ScrollStyle);
69  /// @brief Child specific update method.
70  virtual void UpdateImpl(bool Force = false);
71  /// @brief Child specific visibility method.
72  virtual void SetVisibleImpl(bool visible);
73  /// @brief Child specific mouse hover method.
74  virtual bool CheckMouseHoverImpl();
75  //public:
76  /// @brief Class constructor.
77  /// @param name The Name for the Widget.
78  /// @param RendRect The renderable rect representing the position and size of this widget.
79  /// @param LineHeight The lineheight you want the text to have. If the Rect passed in is relative, this will expect LineHeight to be relative as well.
80  /// @param ScrollStyle The style of the scrollbar you want for this List Box. See Scrollbar class for more information.
81  /// @param parent The parent screen that created this widget.
82  DropDownList(const String& name, const Rect& RendRect, const Real& LineHeight, const UI::ScrollbarStyle& ScrollStyle, Screen* parent);
83  /// @brief Class constructor.
84  /// @param name The Name for the Widget.
85  /// @param RendRect The renderable rect representing the position and size of ths widget.
86  /// @param Glyph The Glyph index to be applied to all text in this widget. Must be valid.
87  /// @param ScrollStyle The style of the scrollbar you want for this List Box. See Scrollbar
88  /// class for more information.
89  /// @param parent The parent screen that created this widget.
90  DropDownList(const String& name, const Rect& RendRect, const Whole& Glyph, const UI::ScrollbarStyle& ScrollStyle, Screen* parent);
91  /// @brief Class destructor.
92  virtual ~DropDownList();
93  public:
94  /// @brief Manually sets a selection in the list as "selected".
95  /// @param ToBeSelected A pointer to the selection to set as "selected".
96  virtual void SetSelection(Widget* ToBeSelected);
97  /// @brief Manually sets a selection in the list as "selected".
98  /// @param ToBeSelected A string containing the name of the selection to set as "selected".
99  virtual void SetSelection(const String& ToBeSelected);
100  /// @brief Sets the relative position of this widget.
101  /// @details The position is relative to the screen size. Values range from 0.0 to 1.0.
102  /// @param Position A vector2 representing the relative position of this widget.
103  virtual void SetPosition(const Vector2& Position);
104  /// @brief Sets the pixel position of this widget.
105  /// @param Position A vector2 representing the pixel position of this widget.
106  virtual void SetActualPosition(const Vector2& Position);
107  /// @brief Sets the relative size of this widget.
108  /// @details The size is relative to the screen size. Values range from 0.0 to 1.0.
109  /// @param Size A vector2 representing the relative size of this widget.
110  virtual void SetSize(const Vector2& Size);
111  /// @brief Sets the pixel size of this widget.
112  /// @param Size A vector2 representing the pixel size of this widget.
113  virtual void SetActualSize(const Vector2& Size);
114  /// @brief Updates the dimensions of this widget to match those of the new screen size.
115  /// @details This function is called automatically when a viewport changes in size, and shouldn't need to be called manually.
116  virtual void UpdateDimensions();
117  /// @brief Gets the caption showing the current selection in this widget.
118  /// @return Returns a pointer to the caption showing the current selection.
119  virtual Widget* GetSelection();
120  /// @brief Gets the button that toggles the appearance of the listbox in this widget.
121  /// @return Returns a pointer to the button controlling the visibility of the listbox.
122  virtual Button* GetListToggle();
123  /// @brief Gets the listbox showing all the selections in this widget.
124  /// @return Returns a pointer to the listbox containing the possible choices.
125  virtual ListBox* GetSelectionList();
126  };//dropdownlist//*/
127  }//UI
128 }//Mezzanine
129 
130 #endif