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