Resolve "Toggle Free Look with Hotkey"
[ryzomcore.git] / ryzom / client / src / interfaces_manager / scrollable_control.h
blob27fc6e83a6ccd0c4ec843166a805c8a72194b85f
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_SCROLLABLE_CONTROL_H
20 #define NL_SCROLLABLE_CONTROL_H
22 #include "nel/misc/types_nl.h"
23 #include "control.h"
24 #include "scroll_bar.h"
26 /**
27 * class managing scrollable controls. These controls can use scroll bars thanks to virtual methods
28 * \author David Fleury
29 * \author Nevrax France
30 * \date 2001
32 class CScrollableControl : public CControl
34 public:
36 /// default Constructor
37 CScrollableControl(uint id);
39 /// constructor
40 CScrollableControl(uint id, float x, float y, float x_pixel, float y_pixel, float w, float h, float w_pixel, float h_pixel)
41 : CControl(id, x, y, x_pixel, y_pixel, w, h, w_pixel, h_pixel)
43 _HScroll = new CScrollBar(0, 0, 0, 0, 0, w , 0, w_pixel , 16, false, this);
44 _VScroll = new CScrollBar(0, 0, 0, 0, 0, 0 , h, 16 , h_pixel, true, this);
46 // set hot spot and origin of the horizontal scroll bar
47 _HScroll->hotSpot( CControl::THotSpot::HS_TR);
48 _HScroll->origin( CControl::THotSpot::HS_BL);
50 // set hot spot and origin of the vertical scroll bar
51 _VScroll->hotSpot( CControl::THotSpot::HS_TL);
52 _VScroll->origin( CControl::THotSpot::HS_BR);
54 // add the scroll bar to the scrollable control children list
55 _Children.push_back( _VScroll );
56 _Children.push_back( _HScroll );
58 _AutoHide = false;
61 /// destructor
62 virtual ~CScrollableControl();
64 /// scroll horizontaly by 'scroll' units in either direction (right if scroll >0 and left is scroll<0 for example) (implementation dependent)
65 virtual void scrollH(sint32 scroll) = 0;
67 /// scroll verticaly by 'scroll' units in either direction
68 virtual void scrollV(sint32 scroll) = 0;
70 /// show(enable)/hide(disable) /create the horizontal scroll bar
71 void hScroll( bool on );
73 /// show(enable)/hide(disable) /create the vertical scroll bar
74 void vScroll( bool on );
76 /// enable/disable auto hiding of the scroll bars
77 void autoHide( bool on );
79 /// manage left mouse button click
80 virtual void click(float x, float y, bool &taken);
82 /// manage right mouse button click
83 virtual void clickRight(float x, float y, bool &taken);
85 /// get a pointer on the horizontal scroll bar
86 CScrollBar *getHScroll() { return _HScroll; }
87 /// get a pointer on the vertical scroll bar
88 CScrollBar *getVScroll() { return _VScroll; }
90 // attributes
91 protected:
92 /// auto-hide the scroll bars when they are unnecessary or just disable them
93 bool _AutoHide;
95 /// the horizontal scroll bar
96 CScrollBar *_HScroll;
98 /// the vertical scroll bar
99 CScrollBar *_VScroll;
103 #endif // NL_SCROLLABLE_CONTROL_H
105 /* End of scrollable_control.h */