Pyrogenesis  trunk
IGUIScrollBarOwner.h
Go to the documentation of this file.
1 /* Copyright (C) 2015 Wildfire Games.
2  * This file is part of 0 A.D.
3  *
4  * 0 A.D. 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 2 of the License, or
7  * (at your option) any later version.
8  *
9  * 0 A.D. 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 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef INCLUDED_IGUISCROLLBAROWNER
19 #define INCLUDED_IGUISCROLLBAROWNER
20 
21 #include "GUI.h"
22 
23 struct SGUIScrollBarStyle;
24 class IGUIScrollBar;
25 
26 /**
27  * Base-class this if you want an object to contain
28  * one, or several, scroll-bars.
29  *
30  * @see IGUIObject
31  * @see IGUIScrollBar
32  */
33 class IGUIScrollBarOwner : virtual public IGUIObject
34 {
35  friend class IGUIScrollBar;
36 
37 public:
39  virtual ~IGUIScrollBarOwner();
40 
41  virtual void Draw();
42 
43  /**
44  * @see IGUIObject#HandleMessage()
45  */
46  virtual void HandleMessage(SGUIMessage& Message);
47 
48  /**
49  * @see IGUIObject#ResetStates()
50  */
51  virtual void ResetStates();
52 
53  /**
54  * Interface for the m_ScrollBar to use.
55  */
56  virtual const SGUIScrollBarStyle* GetScrollBarStyle(const CStr& style) const;
57 
58  /**
59  * Add a scroll-bar
60  */
61  virtual void AddScrollBar(IGUIScrollBar* scrollbar);
62 
63  /**
64  * Get Scroll Bar reference (it should be transparent it's actually
65  * pointers).
66  */
67  virtual IGUIScrollBar& GetScrollBar(const int& index)
68  {
69  return *m_ScrollBars[index];
70  }
71 
72  /**
73  * Get the position of the scroll bar at @param index.
74  * Equivalent to GetScrollbar(index).GetPos().
75  */
76  virtual float GetScrollBarPos(const int index) const;
77 
78 protected:
79 
80  /**
81  * Predominately you will only have one, but you can have
82  * as many as you like.
83  */
84  std::vector<IGUIScrollBar*> m_ScrollBars;
85 };
86 
87 #endif // INCLUDED_IGUISCROLLBAROWNER
virtual const SGUIScrollBarStyle * GetScrollBarStyle(const CStr &style) const
Interface for the m_ScrollBar to use.
Definition: IGUIScrollBarOwner.cpp:47
virtual IGUIScrollBar & GetScrollBar(const int &index)
Get Scroll Bar reference (it should be transparent it&#39;s actually pointers).
Definition: IGUIScrollBarOwner.h:67
The GUI Scroll-bar style.
Definition: IGUIScrollBar.h:50
Base settings, all objects possess these settings in their m_BaseSettings Instructions can be found i...
Definition: IGUIObject.h:117
std::vector< IGUIScrollBar * > m_ScrollBars
Predominately you will only have one, but you can have as many as you like.
Definition: IGUIScrollBarOwner.h:84
virtual void AddScrollBar(IGUIScrollBar *scrollbar)
Add a scroll-bar.
Definition: IGUIScrollBarOwner.cpp:40
IGUIScrollBarOwner()
Definition: IGUIScrollBarOwner.cpp:22
virtual void Draw()
Draws the object.
Definition: IGUIScrollBarOwner.cpp:71
virtual float GetScrollBarPos(const int index) const
Get the position of the scroll bar at.
Definition: IGUIScrollBarOwner.cpp:77
virtual ~IGUIScrollBarOwner()
Definition: IGUIScrollBarOwner.cpp:26
virtual void ResetStates()
Definition: IGUIScrollBarOwner.cpp:32
The GUI Scroll-bar, used everywhere there is a scroll-bar in the game.
Definition: IGUIScrollBar.h:155
Message send to IGUIObject::HandleMessage() in order to give life to Objects manually with a derived ...
Definition: GUIbase.h:91
Base-class this if you want an object to contain one, or several, scroll-bars.
Definition: IGUIScrollBarOwner.h:33
virtual void HandleMessage(SGUIMessage &Message)
Definition: IGUIScrollBarOwner.cpp:65