ScummVM API documentation
qd_interface_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
23#ifndef QDENGINE_QDCORE_QD_INTERFACE_SLIDER_H
24#define QDENGINE_QDCORE_QD_INTERFACE_SLIDER_H
25
26#include "qdengine/parser/xml_fwd.h"
27#include "qdengine/qdcore/qd_interface_element.h"
28#include "qdengine/qdcore/qd_interface_element_state.h"
29
30
31namespace QDEngine {
32
33
35
40public:
43 SL_HORIZONTAL,
44 SL_VERTICAL
45 };
46
50
51 qdInterfaceSlider &operator = (const qdInterfaceSlider &sl);
52
56 }
57
61 bool keyboard_handler(Common::KeyCode vkey);
62
63 int option_value() const;
64 bool set_option_value(int value);
65
67
70 bool init(bool is_game_active = true);
71
73 bool redraw() const;
74
75 grScreenRegion screen_region() const;
76
78 int size_x() const;
80 int size_y() const;
81
82 bool inverse_direction() const {
83 return _inverse_direction;
84 }
85 void set_inverse_direction(bool state) {
86 _inverse_direction = state;
87 }
88
89 const Vect2i &active_rectangle() const {
90 return _active_rectangle;
91 }
92 void set_active_rectangle(const Vect2i &rect) {
93 _active_rectangle = rect;
94 }
95
96 const qdInterfaceElementState *background() const {
97 return &_background;
98 }
99 void update_background(const qdInterfaceElementState &st) {
100 _background = st;
101 }
102
103 const Vect2i &background_offset() const {
104 return _background_offset;
105 }
106 void set_background_offset(const Vect2i &offs) {
107 _background_offset = offs;
108 }
109
110 const qdInterfaceElementState *slider() const {
111 return &_slider;
112 }
113 void update_slider(const qdInterfaceElementState &st) {
114 _slider = st;
115 }
116
117 float phase() const {
118 return _phase;
119 }
120 void set_phase(float ph) {
121 _phase = ph;
122 }
123
124 orientation_t orientation() const {
125 return _orientation;
126 }
127 void set_orientation(orientation_t v) {
128 _orientation = v;
129 }
130
132 bool hit_test(int x, int y) const;
133
134protected:
135
137 bool save_script_body(Common::WriteStream &fh, int indent = 0) const;
140
141private:
143 qdInterfaceElementState _background;
145 Vect2i _background_offset;
146
149
151 qdAnimation _slider_animation;
152
154
158 Vect2i _active_rectangle;
159
161 float _phase;
162
164 orientation_t _orientation;
165 bool _inverse_direction;
166
168 bool _track_mouse;
169
170 bool set_slider_animation(const qdAnimation *anm, int anm_flags = 0);
171
173 Vect2i phase2offset(float ph) const;
175 float offset2phase(const Vect2i &offs) const;
176
177};
178
179} // namespace QDEngine
180
181#endif // QDENGINE_QDCORE_QD_INTERFACE_SLIDER_H
Definition: stream.h:77
Definition: xmath.h:268
Прямоугольная область на экране.
Definition: gr_screen_region.h:31
mouseEvent
События.
Definition: mouse_input.h:41
Анимация.
Definition: qd_animation.h:57
Базовый класс для элементов GUI.
Definition: qd_interface_element.h:41
element_type
Типы элементов интерфейса.
Definition: qd_interface_element.h:65
@ EL_SLIDER
слайдер
Definition: qd_interface_element.h:71
Состояние элемента интерфейса.
Definition: qd_interface_element_state.h:156
Интерфейсный элемент - слайдер.
Definition: qd_interface_slider.h:39
bool mouse_handler(int x, int y, mouseDispatcher::mouseEvent ev)
Обработчик событий мыши.
bool hit_test(int x, int y) const
Возвращает true, если точка с экранными координатами (x,у) попадает в элемент.
bool redraw() const
Отрисовка элемента.
bool save_script_body(Common::WriteStream &fh, int indent=0) const
Запись данных в скрипт.
bool load_script_body(const xml::tag *p)
Загрузка данных из скрипта.
bool init(bool is_game_active=true)
Инициализация элемента.
orientation_t
Ориентация слайдера (по-умолчанию - горизонтально).
Definition: qd_interface_slider.h:42
int option_value() const
Возвращает значение настройки игры, связанной с элементом.
int size_x() const
Возвращает размер элемента по горизонтали в пикселах.
int size_y() const
Возвращает размер элемента по вертикали в пикселах.
bool set_option_value(int value)
Устанавливает значение настройки игры, связанной с элементом.
bool keyboard_handler(Common::KeyCode vkey)
Обработчик ввода с клавиатуры.
qdInterfaceElement::element_type get_element_type() const
Возвращает тип элемента.
Definition: qd_interface_slider.h:54
XML тег.
Definition: xml_tag.h:33
Базовый класс для игровых ресурсов.
Definition: console.h:28