ScummVM API documentation
qd_interface_counter.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 QDENGINE_QDCORE_QD_INTERFACE_COUNTER_H
23#define QDENGINE_QDCORE_QD_INTERFACE_COUNTER_H
24
25#include "qdengine/qdcore/qd_named_object_reference.h"
26#include "qdengine/qdcore/qd_screen_text.h"
27#include "qdengine/qdcore/qd_interface_element.h"
28
29
30namespace QDEngine {
31
33
35public:
39
40 qdInterfaceCounter &operator = (const qdInterfaceCounter &counter);
41
45 }
46
50 bool keyboard_handler(Common::KeyCode vkey);
51
52 grScreenRegion screen_region() const;
53
55
58 bool init(bool is_game_active = true);
59
60 bool redraw() const;
61 bool need_redraw() const;
62 bool post_redraw();
63
65 int size_x() const;
67 int size_y() const;
68
70 int digits() const {
71 return _digits;
72 }
73 void setDigits(int digits) {
74 _digits = digits;
75 }
76
77 const qdScreenTextFormat &textFormat() const {
78 return _textFormat;
79 }
80 void setTextFormat(const qdScreenTextFormat &text_format) {
81 _textFormat = text_format;
82 }
83
84 const qdCounter *counter() const {
85 return _counter;
86 }
87 void setCounter(const qdCounter *counter);
88
89 const char *counterName() const;
90 void setCounterName(const char *name);
91
92protected:
93
95 bool save_script_body(Common::WriteStream &fh, int indent = 0) const;
97 bool load_script_body(const xml::tag *p);
98
99 Common::String data() const;
100
101private:
102
103 qdScreenTextFormat _textFormat;
104
105 int _digits;
106
107 Common::String _counterName;
108 const qdCounter *_counter;
109
110 int _lastValue;
111};
112
113} // namespace QDEngine
114
115#endif // QDENGINE_QDCORE_QD_INTERFACE_COUNTER_H
Definition: str.h:59
Definition: stream.h:77
Прямоугольная область на экране.
Definition: gr_screen_region.h:31
mouseEvent
События.
Definition: mouse_input.h:41
Счетчик состояний.
Definition: qd_counter.h:73
Interface widget for displaying a counter.
Definition: qd_interface_counter.h:34
int size_x() const
Возвращает размер элемента по горизонтали в пикселах.
bool init(bool is_game_active=true)
Инициализация элемента.
int size_y() const
Возвращает размер элемента по вертикали в пикселах.
qdInterfaceElement::element_type get_element_type() const
Возвращает тип элемента.
Definition: qd_interface_counter.h:43
bool load_script_body(const xml::tag *p)
Загрузка данных из скрипта.
bool redraw() const
Отрисовка элемента.
bool keyboard_handler(Common::KeyCode vkey)
Обработчик ввода с клавиатуры.
int digits() const
количество отображаемых разрядов
Definition: qd_interface_counter.h:70
bool mouse_handler(int x, int y, mouseDispatcher::mouseEvent ev)
Обработчик событий мыши.
bool save_script_body(Common::WriteStream &fh, int indent=0) const
Запись данных в скрипт.
Базовый класс для элементов GUI.
Definition: qd_interface_element.h:41
element_type
Типы элементов интерфейса.
Definition: qd_interface_element.h:65
@ EL_COUNTER
счётчик
Definition: qd_interface_element.h:77
const char * name() const
Возвращает имя объекта.
Definition: qd_named_object_base.h:40
Обозначает отсутствие шрифта
Definition: qd_screen_text.h:39
XML тег.
Definition: xml_tag.h:33
Базовый класс для игровых ресурсов.
Definition: console.h:28