ScummVM API documentation
qd_interface_screen.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_SCREEN_H
24#define QDENGINE_QDCORE_QD_INTERFACE_SCREEN_H
25
26#include "common/keyboard.h"
27
28#include "qdengine/parser/xml_fwd.h"
29#include "qdengine/xmath.h"
30#include "qdengine/qdcore/qd_interface_object_base.h"
31#include "qdengine/qdcore/qd_object_list_container.h"
32#include "qdengine/qdcore/qd_resource_dispatcher.h"
33#include "qdengine/qdcore/qd_music_track.h"
34#include "qdengine/system/graphics/gr_screen_region.h"
35#include "qdengine/system/input/mouse_input.h"
36
37
38namespace QDEngine {
39
40class qdInterfaceElement;
41class qdInterfaceElementState;
42
45public:
48
50 bool save_script(Common::WriteStream &fh, int indent = 0) const;
52 bool load_script(const xml::tag *p);
53
55 bool redraw(int dx = 0, int dy = 0) const;
56
57 bool pre_redraw(bool force_full_redraw = false);
58 bool post_redraw();
59
61 bool quant(float dt);
62
66 bool rename_element(qdInterfaceElement *p, const char *name);
70 qdInterfaceElement *get_element(const char *el_name);
73
77 return _elements.get_list();
78 }
79
83 bool keyboard_handler(Common::KeyCode vkey);
84 bool char_input_handler(int vkey);
85
87 qdResource *add_resource(const Common::Path &file_name, const qdInterfaceElementState *res_owner);
89 bool remove_resource(const Common::Path &file_name, const qdInterfaceElementState *res_owner);
91 bool has_references(const qdResource *p) const {
92 return _resources.is_registered(p);
93 }
94
96 bool hide_element(const char *element_name, bool temporary_hide = true);
98 bool hide_element(qdInterfaceElement *p, bool temporary_hide = true);
100 bool show_element(const char *element_name);
103
105 bool init(bool is_game_active = true);
106
109
112 _is_locked = true;
113 }
116 _is_locked = false;
117 }
119 bool is_locked() const {
120 return _is_locked;
121 }
122
125
126 void update_personage_buttons();
127
128 float autohide_time() const {
129 return _autohide_time;
130 }
131 void set_autohide_time(float time) {
132 _autohide_time = time;
133 }
134
135 const Vect2i &autohide_offset() const {
136 return _autohide_offset;
137 }
138 void set_autohide_offset(const Vect2i &offset) {
139 _autohide_offset = offset;
140 }
141
143 const qdMusicTrack &music_track() const {
144 return _music_track;
145 }
147 void set_music_track(const qdMusicTrack &track) {
148 _music_track = track;
149 }
151 bool has_music_track() const {
152 return _music_track.has_file_name();
153 }
154
155 void set_autohide_phase(float ph) {
156 _autohide_phase = ph;
157 }
158
159 // Указатель на объект, последним вызвавший данный как модальный экран
160 qdInterfaceObjectBase *modal_caller() {
161 return _modal_caller;
162 }
163 void set_modal_caller(qdInterfaceObjectBase *caller) {
164 _modal_caller = caller;
165 }
166
167private:
168
170 qdObjectListContainer<qdInterfaceElement> _elements;
171
173 qdResourceDispatcher<qdInterfaceElementState> _resources;
174
175 typedef Std::vector<qdInterfaceElement *> sorted_element_list_t;
177 sorted_element_list_t _sorted_elements;
178
180 bool sort_elements();
181
183 bool _is_locked;
184
186 float _autohide_time;
188 Vect2i _autohide_offset;
189
191 float _autohide_phase;
192
194 qdMusicTrack _music_track;
195
197 qdInterfaceObjectBase *_modal_caller;
198};
199
200} // namespace QDEngine
201
202#endif // QDENGINE_QDCORE_QD_INTERFACE_SCREEN_H
Definition: path.h:52
Definition: stream.h:77
mouseEvent
События.
Definition: mouse_input.h:41
Базовый класс для элементов GUI.
Definition: qd_interface_element.h:41
Состояние элемента интерфейса.
Definition: qd_interface_element_state.h:156
Базовый класс для всех интерфейсных объектов.
Definition: qd_interface_object_base.h:32
Интерфейсный экран.
Definition: qd_interface_screen.h:44
void set_music_track(const qdMusicTrack &track)
Устанавливает фоновую музыку.
Definition: qd_interface_screen.h:147
const qdMusicTrack & music_track() const
Фоновая музыка.
Definition: qd_interface_screen.h:143
bool save_script(Common::WriteStream &fh, int indent=0) const
Запись данных в скрипт.
bool show_element(const char *element_name)
Показывает элемент.
bool hide_element(const char *element_name, bool temporary_hide=true)
Прячет элемент.
bool remove_resource(const Common::Path &file_name, const qdInterfaceElementState *res_owner)
Удаляет ресурс file_name с владельцем owner.
bool mouse_handler(int x, int y, mouseDispatcher::mouseEvent ev)
Обработчик событий мыши.
bool is_element_in_list(const qdInterfaceElement *el) const
Возвращает true, если элемент есть в списке.
bool init(bool is_game_active=true)
Инициализация экрана при заходе на него.
bool show_element(qdInterfaceElement *p)
Показывает элемент.
bool add_element(qdInterfaceElement *p)
Добавление элемента.
bool has_music_track() const
Возвращает true, если экрану задана фоновая музыка.
Definition: qd_interface_screen.h:151
bool keyboard_handler(Common::KeyCode vkey)
Обработчик ввода с клавиатуры.
bool hide_element(qdInterfaceElement *p, bool temporary_hide=true)
Прячет элемент.
bool remove_element(qdInterfaceElement *p)
Удаление элемента из списка.
void activate_personage_buttons(const qdNamedObject *p)
Включает кнопки, связанные с персонажем p, выключает кнопки остальных персонажей.
bool rename_element(qdInterfaceElement *p, const char *name)
Изменение имени элемента.
bool redraw(int dx=0, int dy=0) const
Отрисовка экрана.
qdInterfaceElement * get_element(const char *el_name)
Поиск элемента по имени.
bool quant(float dt)
Обсчет логики, параметр - время в секундах.
void unlock_resources()
Устанавливает, что ресурсы экрана надо выгружать при выходе с него.
Definition: qd_interface_screen.h:115
bool load_script(const xml::tag *p)
Загрузка данных из скрипта.
bool build_visible_elements_list()
Строит сортированный список видимых элементов.
const element_list_t & element_list() const
Возвращает список элементов экрана.
Definition: qd_interface_screen.h:76
bool is_locked() const
Возвращает true, если ресурсы экрана не надо выгружать при выходе с него.
Definition: qd_interface_screen.h:119
bool has_references(const qdResource *p) const
Возвращает true, если на ресурс есть ссылки.
Definition: qd_interface_screen.h:91
void lock_resources()
Устанавливает, что ресурсы экрана не надо выгружать при выходе с него.
Definition: qd_interface_screen.h:111
qdResource * add_resource(const Common::Path &file_name, const qdInterfaceElementState *res_owner)
Добавляет ресурс file_name с владельцем owner.
Definition: qd_music_track.h:43
const char * name() const
Возвращает имя объекта.
Definition: qd_named_object_base.h:40
Поименованный объект.
Definition: qd_named_object.h:70
bool is_registered(const qdResource *res, const T *res_owner=NULL) const
Возвращает true, если ресурс res (опционально - с владельцем res_owner) есть в списке.
Definition: qd_resource_dispatcher.h:62
Definition: qd_resource.h:34
XML тег.
Definition: xml_tag.h:33
Definition: list.h:39
Базовый класс для игровых ресурсов.
Definition: console.h:28