ScummVM API documentation
WidgetSlider.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 /*
23  * Copyright (C) 2006-2010 - Frictional Games
24  *
25  * This file is part of HPL1 Engine.
26  */
27 
28 #ifndef HPL_WIDGET_SLIDER_H
29 #define HPL_WIDGET_SLIDER_H
30 
31 #include "hpl1/engine/gui/Widget.h"
32 
33 namespace hpl {
34 
35 class cGuiSkinFont;
36 
37 class cWidgetButton;
38 
39 //---------------------------------------------
40 
41 class cWidgetSlider : public iWidget {
42 public:
43  cWidgetSlider(cGuiSet *apSet, cGuiSkin *apSkin, eWidgetSliderOrientation aOrientation);
44  virtual ~cWidgetSlider();
45 
46  int GetValue() { return mlValue; }
47  void SetValue(int alValue);
48 
49  int GetMaxValue() { return mlMaxValue; }
50  void SetMaxValue(int alMax);
51 
52  int GetButtonValueAdd() { return mlButtonValueAdd; }
53  void SetButtonValueAdd(int alAdd);
54 
55  int GetBarValueSize() { return mlBarValueSize; }
56  void SetBarValueSize(int alSize);
57 
58  float GetButtonSize() const { return mfButtonSize; }
59 
60 protected:
62  // Own functions
63  void UpdateBarProperties();
64 
65  bool ArrowButtonDown(iWidget *apWidget, cGuiMessageData &aData);
66  kGuiCalllbackDeclarationEnd(ArrowButtonDown);
67 
69  // Implemented functions
70  void OnInit();
71  void OnLoadGraphics();
72  void OnChangeSize();
73  void OnChangePosition();
74 
75  void OnDraw(float afTimeStep, cGuiClipRegion *apClipRegion);
76 
77  bool OnMouseMove(cGuiMessageData &aData);
78  bool OnMouseDown(cGuiMessageData &aData);
79  bool OnMouseUp(cGuiMessageData &aData);
80  bool OnMouseEnter(cGuiMessageData &aData);
81  bool OnMouseLeave(cGuiMessageData &aData);
82 
83  bool OnLostFocus(cGuiMessageData &aData);
84 
86  // Data
87  eWidgetSliderOrientation mOrientation;
88 
89  bool mbPressed;
90 
91  float mfButtonSize;
92 
93  int mlValue;
94  int mlMaxValue;
95  int mlButtonValueAdd;
96  int mlBarValueSize; // This is how big the bar is compared to the max value of the slider
97  float mfValueStep;
98 
99  cVector3f mvBarPos;
100  cVector2f mvBarSize;
101  float mfSliderSize;
102  cRect2f mBarRect;
103  float mfMaxPos;
104  float mfMinPos;
105 
106  cVector2f mvRelMousePos;
107 
108  cWidgetButton *mvButtons[2];
109 
110  cGuiGfxElement *mpGfxButtonBackground;
111  cGuiGfxElement *mvGfxBorders[4];
112  cGuiGfxElement *mvGfxCorners[4];
113 
114  cGuiGfxElement *mvGfxArrow[2];
115  cGuiGfxElement *mpGfxBackground;
116 };
117 
118 } // namespace hpl
119 
120 #endif // HPL_WIDGET_SLIDER_H
Definition: AI.h:36
Definition: GuiGfxElement.h:72
Definition: GuiTypes.h:263
Definition: Widget.h:65
Definition: WidgetSlider.h:41
Definition: GuiSet.h:112
Definition: GuiSet.h:96
Definition: WidgetButton.h:37
Definition: GuiSkin.h:59