]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/CGUIScrollBar.h
170a2da0b0829c60727d9ee4f70d4f6692613396
[irrlicht.git] / source / Irrlicht / CGUIScrollBar.h
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt\r
2 // This file is part of the "Irrlicht Engine".\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h\r
4 \r
5 #ifndef __C_GUI_SCROLL_BAR_H_INCLUDED__\r
6 #define __C_GUI_SCROLL_BAR_H_INCLUDED__\r
7 \r
8 #include "IrrCompileConfig.h"\r
9 #ifdef _IRR_COMPILE_WITH_GUI_\r
10 \r
11 #include "IGUIScrollBar.h"\r
12 #include "IGUIButton.h"\r
13 \r
14 namespace irr\r
15 {\r
16 namespace gui\r
17 {\r
18 \r
19         class CGUIScrollBar : public IGUIScrollBar\r
20         {\r
21         public:\r
22 \r
23                 //! constructor\r
24                 CGUIScrollBar(bool horizontal, IGUIEnvironment* environment,\r
25                         IGUIElement* parent, s32 id, core::rect<s32> rectangle,\r
26                         bool noclip=false);\r
27 \r
28                 //! destructor\r
29                 virtual ~CGUIScrollBar();\r
30 \r
31                 //! called if an event happened.\r
32                 bool OnEvent(const SEvent& event) override;\r
33 \r
34                 //! draws the element and its children\r
35                 void draw() override;\r
36 \r
37                 void OnPostRender(u32 timeMs) override;\r
38 \r
39 \r
40                 //! gets the maximum value of the scrollbar.\r
41                 s32 getMax() const override;\r
42 \r
43                 //! sets the maximum value of the scrollbar.\r
44                 void setMax(s32 max) override;\r
45 \r
46                 //! gets the minimum value of the scrollbar.\r
47                 s32 getMin() const override;\r
48 \r
49                 //! sets the minimum value of the scrollbar.\r
50                 void setMin(s32 min) override;\r
51 \r
52                 //! gets the small step value\r
53                 s32 getSmallStep() const override;\r
54 \r
55                 //! sets the small step value\r
56                 void setSmallStep(s32 step) override;\r
57 \r
58                 //! gets the large step value\r
59                 s32 getLargeStep() const override;\r
60 \r
61                 //! sets the large step value\r
62                 void setLargeStep(s32 step) override;\r
63 \r
64                 //! gets the current position of the scrollbar\r
65                 s32 getPos() const override;\r
66 \r
67                 //! sets the position of the scrollbar\r
68                 void setPos(s32 pos) override;\r
69 \r
70                 //! updates the rectangle\r
71                 void updateAbsolutePosition() override;\r
72 \r
73         private:\r
74 \r
75                 void refreshControls();\r
76                 s32 getPosFromMousePos(const core::position2di &p) const;\r
77 \r
78                 IGUIButton* UpButton;\r
79                 IGUIButton* DownButton;\r
80 \r
81                 core::rect<s32> SliderRect;\r
82 \r
83                 bool Dragging;\r
84                 bool Horizontal;\r
85                 bool DraggedBySlider;\r
86                 bool TrayClick;\r
87                 s32 Pos;\r
88                 s32 DrawPos;\r
89                 s32 DrawHeight;\r
90                 s32 Min;\r
91                 s32 Max;\r
92                 s32 SmallStep;\r
93                 s32 LargeStep;\r
94                 s32 DesiredPos;\r
95                 u32 LastChange;\r
96                 video::SColor CurrentIconColor;\r
97 \r
98                 f32 range () const { return (f32) ( Max - Min ); }\r
99         };\r
100 \r
101 } // end namespace gui\r
102 } // end namespace irr\r
103 \r
104 #endif // _IRR_COMPILE_WITH_GUI_\r
105 \r
106 #endif\r
107 \r