ScummVM API documentation
gui_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 AGS_SHARED_GUI_GUI_SLIDER_H
23#define AGS_SHARED_GUI_GUI_SLIDER_H
24
25#include "common/std/vector.h"
26#include "ags/shared/gui/gui_object.h"
27
28namespace AGS3 {
29namespace AGS {
30namespace Shared {
31
32class GUISlider : public GUIObject {
33public:
34 GUISlider();
35
36 // Tells if the slider is horizontal (otherwise - vertical)
37 bool IsHorizontal() const;
38 bool IsOverControl(int x, int y, int leeway) const override;
39
40 // Compatibility: sliders are not clipped as of 3.6.0
41 bool IsContentClipped() const override { return false; }
42 bool HasAlphaChannel() const override;
43
44 // Operations
45 Rect CalcGraphicRect(bool clipped) override;
46 void Draw(Bitmap *ds, int x = 0, int y = 0) override;
47
48 // Events
49 bool OnMouseDown() override;
50 void OnMouseMove(int xp, int yp) override;
51 void OnMouseUp() override;
52
53 // Serialization
54 void ReadFromFile(Stream *in, GuiVersion gui_version) override;
55 void WriteToFile(Stream *out) const override;
56 void ReadFromSavegame(Stream *in, GuiSvgVersion svg_ver) override;
57 void WriteToSavegame(Stream *out) const override;
58
59 // TODO: these members are currently public; hide them later
60public:
61 int32_t MinValue;
62 int32_t MaxValue;
63 int32_t Value;
64 int32_t BgImage;
65 int32_t HandleImage;
66 int32_t HandleOffset;
67 bool IsMousePressed;
68
69private:
70 // Updates dynamic metrics and positions of elements
71 void UpdateMetrics();
72
73 // Cached coordinates of slider bar; in relative coords
74 Rect _cachedBar;
75 // Cached coordinates of slider handle; in relative coords
76 Rect _cachedHandle;
77 // The length of the handle movement range, in pixels
78 int _handleRange;
79};
80
81} // namespace Shared
82} // namespace AGS
83} // namespace AGS3
84
85#endif
Definition: allegro_bitmap.h:44
Definition: gui_object.h:44
Definition: gui_slider.h:32
Definition: stream.h:52
Definition: geometry.h:219
Definition: lobject.h:59