1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
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.
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"
24 #include "nel/misc/rgba.h"
28 class CScrollableControl
;
32 * \author David Fleury
33 * \author Nevrax France
36 class CScrollBar
: public CControl
40 ///default 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
);
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
; }
62 * set the texture of the button 'up' when 'On'
63 * \param uint textureId
65 void setUpArrowTextureOn( uint textureId
) { _UpTextureOn
= textureId
; }
68 * set the texture of the button 'up' when 'Off'
69 * \param uint textureId
71 void setUpArrowTextureOff( uint textureId
) { _UpTextureOff
= textureId
; }
74 * set the texture of the button 'down' when 'On'
75 * \param uint textureId
77 void setDownArrowTextureOn( uint textureId
) { _DownTextureOn
= textureId
; }
80 * set the texture of the button 'down' when 'Off'
81 * \param uint textureId
83 void setDownArrowTextureOff( uint textureId
) { _DownTextureOff
= textureId
; }
86 * set the texture of the button 'left' when 'On'
87 * \param uint textureId
89 void setLeftArrowTextureOn( uint textureId
) { _LeftTextureOn
= textureId
; }
92 * set the texture of the button 'left' when 'Off'
93 * \param uint textureId
95 void setLeftArrowTextureOff( uint textureId
) { _LeftTextureOff
= textureId
; }
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).
125 /// Enable or Disable the scroll bar.
129 * get the display size of the scroll bar (width if Vertical, Height if horizontal)
139 /// tells if the control, is vertical or horizontal
142 /// the scroll bar size (in units)
145 /// the current position of the slider
148 /// the number of displayed unit
149 uint32 _NbDisplayedUnit
;
151 /// texture of the upper arrow 'on'
153 /// texture of the upper arrow 'off'
156 /// texture of the down arrow 'on'
158 /// texture of the down arrow 'off'
159 uint _DownTextureOff
;
161 /// texture of the left arrow 'on'
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
178 /// texture of the scroll bar when disabled
179 uint32 _TextureDisable
;
181 /// state of the scroll bar (enable/disable)
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 */