Merge branch '138-toggle-free-look-with-hotkey' into main/gingo-test
[ryzomcore.git] / ryzom / client / src / interfaces_manager / scroll_bar.h
blob0bd75cb11a0f04024d4ecc18d7f360449a778040
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program 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 Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef NL_SCROLL_BAR_H
20 #define NL_SCROLL_BAR_H
22 #include "nel/misc/types_nl.h"
23 #include "control.h"
24 #include "nel/misc/rgba.h"
28 class CScrollableControl;
30 /**
31 * <Class description>
32 * \author David Fleury
33 * \author Nevrax France
34 * \date 2001
36 class CScrollBar : public CControl
38 public:
40 ///default Constructor
41 CScrollBar(uint id);
43 /// constructor
44 CScrollBar(uint id, float x, float y, float x_pixel, float y_pixel, float w, float h, float w_pixel, float h_pixel, bool vertical = true,CScrollableControl *ctrl = NULL);
46 /// destructor
47 virtual ~CScrollBar() {}
49 /// Display the control
50 virtual void display();
52 /// Manage the click of the mouse for control
53 virtual void click(float x, float y, bool &taken);
55 /// set the number of unit
56 void setNbUnit(uint32 nbUnits) { _NbUnits = nbUnits; }
58 /// set the number of unit displayed
59 void setNbDisplayedUnit(uint32 nbUnits) { _NbDisplayedUnit = nbUnits; }
61 /**
62 * set the texture of the button 'up' when 'On'
63 * \param uint textureId
65 void setUpArrowTextureOn( uint textureId) { _UpTextureOn = textureId; }
67 /**
68 * set the texture of the button 'up' when 'Off'
69 * \param uint textureId
71 void setUpArrowTextureOff( uint textureId) { _UpTextureOff = textureId; }
73 /**
74 * set the texture of the button 'down' when 'On'
75 * \param uint textureId
77 void setDownArrowTextureOn( uint textureId) { _DownTextureOn = textureId; }
79 /**
80 * set the texture of the button 'down' when 'Off'
81 * \param uint textureId
83 void setDownArrowTextureOff( uint textureId) { _DownTextureOff = textureId; }
85 /**
86 * set the texture of the button 'left' when 'On'
87 * \param uint textureId
89 void setLeftArrowTextureOn( uint textureId) { _LeftTextureOn = textureId; }
91 /**
92 * set the texture of the button 'left' when 'Off'
93 * \param uint textureId
95 void setLeftArrowTextureOff( uint textureId) { _LeftTextureOff = textureId; }
97 /**
98 * set the texture of the button 'right' when 'On'
99 * \param uint textureId
101 void setRightArrowTextureOn( uint textureId) { _RightTextureOn = textureId; }
104 * set the texture of the button 'right' when 'Off'
105 * \param uint textureId
107 void setRightArrowTextureOff( uint textureId) { _RightTextureOff = textureId; }
110 /// Change color when On.
111 void colorOn(const NLMISC::CRGBA &color);
113 /// Change color when Disable.
114 void colorDisable(const NLMISC::CRGBA &color);
116 /// Change texture when On.
117 void textureOn(uint32 texture);
119 /// Change texture when Disable.
120 void textureDisable(uint32 texture);
122 /// Get the state of the scroll bar (Enable/Disable).
123 bool enable();
125 /// Enable or Disable the scroll bar.
126 void enable(bool e);
129 * get the display size of the scroll bar (width if Vertical, Height if horizontal)
131 float size() const;
133 private:
134 /// init function
135 void init();
137 // attributes
138 private:
139 /// tells if the control, is vertical or horizontal
140 bool _Vertical;
142 /// the scroll bar size (in units)
143 uint32 _NbUnits;
145 /// the current position of the slider
146 uint32 _CurrentUnit;
148 /// the number of displayed unit
149 uint32 _NbDisplayedUnit;
151 /// texture of the upper arrow 'on'
152 uint _UpTextureOn;
153 /// texture of the upper arrow 'off'
154 uint _UpTextureOff;
156 /// texture of the down arrow 'on'
157 uint _DownTextureOn;
158 /// texture of the down arrow 'off'
159 uint _DownTextureOff;
161 /// texture of the left arrow 'on'
162 uint _LeftTextureOn;
163 /// texture of the left arrow 'off'
164 uint _LeftTextureOff;
166 /// texture of the right arrow 'on'
167 uint _RightTextureOn;
168 /// texture of the right arrow 'off'
169 uint _RightTextureOff;
172 /// color of the scroll bar
173 NLMISC::CRGBA _ColorOn;
174 /// color of the scroll bar when disabled
175 NLMISC::CRGBA _ColorDisable;
176 /// texture of the scroll bar when disabled
177 uint32 _TextureOn;
178 /// texture of the scroll bar when disabled
179 uint32 _TextureDisable;
181 /// state of the scroll bar (enable/disable)
182 bool _Enable;
184 /// the height (if vertical, width if horizontal) of the button, in proportion of th window (0-1)
185 float _ButtonDisplaySize;
189 #endif // NL_SCROLL_BAR_H
191 /* End of scroll_bar.h */