ScummVM API documentation
pet_slider.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#ifndef TITANIC_PET_SLIDER_H
23#define TITANIC_PET_SLIDER_H
24
25#include "titanic/support/rect.h"
26#include "titanic/support/string.h"
27#include "titanic/core/game_object.h"
28
29namespace Titanic {
30
31enum SliderOrientation { ORIENTATION_HORIZONTAL = 1, ORIENTATION_VERTICAL = 2 };
32
33class CPetControl;
34
36private:
37 int _orientation;
38 Rect _bounds;
39 Rect _slidingRect;
40 int _thumbWidth;
41 int _thumbHeight;
42 int _sliderOffset;
43 bool _thumbFocused;
44 Rect _dirtyArea;
45private:
49 Point getThumbCentroidPos() const;
50
54 bool thumbContains(const Point &pt) const;
55
59 Rect getThumbRect() const;
60
64 int calcSliderOffset(const Point &pt) const;
65protected:
70
75
79 bool containsPt(const Point &pt) const { return _bounds.contains(pt); }
80public:
81 CPetSlider();
82 virtual ~CPetSlider() {}
83
87 virtual void setupBackground(const CString &name, CPetControl *petControl) {}
88
92 virtual void setupThumb(const CString &name, CPetControl *petControl) {}
93
97 virtual void setupBackground2(const CString &name, CPetControl *petControl) {}
98
102 virtual void setupThumb2(const CString &name, CPetControl *petControl) {}
103
107 virtual void reset(const CString &name) {}
108
112 virtual void draw(CScreenManager *screenManager) {}
113
118
122 virtual bool checkThumb(const Point &pt);
123
127 virtual bool resetThumbFocus();
128
132 virtual bool MouseDragMoveMsg(const Point &pt);
133
137 virtual bool MouseDragEndMsg(const Point &pt) { return true; }
138
142 virtual bool MouseButtonUpMsg(const Point &pt);
143
144 virtual bool proc13() { return false; }
145 virtual bool proc14() { return false; }
146
147
148 virtual bool contains(const Point &pt) const;
149
153 virtual double getOffsetPixels() const;
154
158 virtual void setSliderOffset(double offset);
159
163 virtual void setOffsetPixels(int offset);
164
168 void setOrientation(SliderOrientation orientation);
169
173 void setBounds(const Rect &r) { _bounds = r; }
174
178 void setSlidingBounds(const Rect &r) { _slidingRect = r; }
179
183 void setThumbSize(const Point &pt) {
184 _thumbWidth = pt.x;
185 _thumbHeight = pt.y;
186 }
187
191 void translate(const Point &pt) {
192 _bounds.translate(pt.x, pt.y);
193 _slidingRect.translate(pt.x, pt.y);
194 }
195
199 void stepPosition(int direction);
200};
201
203public:
204 CGameObject *_background;
205 CGameObject *_thumb;
206public:
207 CPetSoundSlider() : CPetSlider(), _background(nullptr),
208 _thumb(0) {}
209
213 void setupBackground(const CString &name, CPetControl *petControl) override;
214
218 void setupThumb(const CString &name, CPetControl *petControl) override;
219
223 void setupBackground2(const CString &name, CPetControl *petControl) override;
224
228 void setupThumb2(const CString &name, CPetControl *petControl) override;
229
233 void draw(CScreenManager *screenManager) override;
234};
235
236} // End of namespace Titanic
237
238#endif /* TITANIC_PET_SLIDER_H */
Definition: game_object.h:79
Definition: pet_control.h:45
Definition: pet_slider.h:35
void translate(const Point &pt)
Definition: pet_slider.h:191
virtual void setupBackground2(const CString &name, CPetControl *petControl)
Definition: pet_slider.h:97
virtual void setOffsetPixels(int offset)
virtual bool MouseDragMoveMsg(const Point &pt)
virtual Rect clearDirtyArea()
virtual bool checkThumb(const Point &pt)
virtual void setSliderOffset(double offset)
virtual void setupBackground(const CString &name, CPetControl *petControl)
Definition: pet_slider.h:87
virtual double getOffsetPixels() const
virtual void setupThumb2(const CString &name, CPetControl *petControl)
Definition: pet_slider.h:102
virtual void setupThumb(const CString &name, CPetControl *petControl)
Definition: pet_slider.h:92
bool containsPt(const Point &pt) const
Definition: pet_slider.h:79
void setThumbSize(const Point &pt)
Definition: pet_slider.h:183
virtual void reset(const CString &name)
Definition: pet_slider.h:107
void stepPosition(int direction)
virtual bool MouseButtonUpMsg(const Point &pt)
void setOrientation(SliderOrientation orientation)
void setBounds(const Rect &r)
Definition: pet_slider.h:173
Point getBackgroundDrawPos()
virtual bool resetThumbFocus()
void setSlidingBounds(const Rect &r)
Definition: pet_slider.h:178
virtual void draw(CScreenManager *screenManager)
Definition: pet_slider.h:112
virtual bool MouseDragEndMsg(const Point &pt)
Definition: pet_slider.h:137
Definition: pet_slider.h:202
void setupThumb(const CString &name, CPetControl *petControl) override
void setupThumb2(const CString &name, CPetControl *petControl) override
void setupBackground(const CString &name, CPetControl *petControl) override
void draw(CScreenManager *screenManager) override
void setupBackground2(const CString &name, CPetControl *petControl) override
Definition: screen_manager.h:49
Definition: string.h:40
Definition: rect.h:35
T y
Definition: rect.h:49
T x
Definition: rect.h:48
Definition: rect.h:144
void translate(T dx, T dy)
Definition: rect.h:409
bool contains(T x, T y) const
Definition: rect.h:246
Definition: display_client.h:58