ScummVM API documentation
menu.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 ULTIMA4_VIEWS_MENU_H
23
#define ULTIMA4_VIEWS_MENU_H
24
25
#include "ultima/ultima4/events/event_handler.h"
26
#include "ultima/ultima4/views/menuitem.h"
27
#include "ultima/ultima4/core/observable.h"
28
#include "ultima/ultima4/core/types.h"
29
30
namespace
Ultima
{
31
namespace
Ultima4 {
32
33
class
Menu;
34
class
TextView;
35
36
class
MenuEvent
{
37
public
:
38
enum
Type {
39
ACTIVATE,
40
INCREMENT,
41
DECREMENT,
42
SELECT,
43
RESET
44
};
45
46
MenuEvent
(
const
Menu
*menu, Type type,
const
MenuItem
*item =
nullptr
) {
47
this->_menu = menu;
48
this->_type = type;
49
this->_item = item;
50
}
51
52
const
Menu
*getMenu() {
53
return
_menu;
54
}
55
Type getType() {
56
return
_type;
57
}
58
const
MenuItem
*getMenuItem() {
59
return
_item;
60
}
61
62
private
:
63
const
Menu
*_menu;
64
Type _type;
65
const
MenuItem
*_item;
66
};
67
71
class
Menu
:
public
Observable
<Menu *, MenuEvent &> {
72
public
:
73
typedef
Common::List<MenuItem *>
MenuItemList
;
74
75
public
:
76
Menu
();
77
~
Menu
();
78
79
void
removeAll();
80
84
void
add(
int
id
,
Common::String
text,
short
x,
short
y,
int
shortcutKey = -1);
85
86
MenuItem
*add(
int
id
,
MenuItem
*item);
87
void
addShortcutKey(
int
id
,
int
shortcutKey);
88
void
setClosesMenu(
int
id
);
89
93
MenuItemList::iterator
getCurrent();
94
98
void
setCurrent(
MenuItemList::iterator
i);
99
void
setCurrent(
int
id
);
100
void
show(
TextView
*view);
101
107
bool
isVisible();
108
112
void
next();
113
117
void
prev();
118
122
void
highlight(
MenuItem
*item);
123
127
MenuItemList::iterator
begin();
128
132
MenuItemList::iterator
end();
133
137
MenuItemList::iterator
begin_visible();
138
145
void
reset(
bool
highlightFirst =
true
);
146
150
MenuItemList::iterator
getById(
int
id
);
151
155
MenuItem
*getItemById(
int
id
);
156
160
void
activateItemAtPos(
TextView
*view,
const
Common::Point
&pt);
161
169
void
activateItem(
int
id
, MenuEvent::Type action);
170
175
bool
activateItemByShortcut(
int
key, MenuEvent::Type action);
176
180
bool
getClosed()
const
;
181
185
void
setClosed(
bool
closed);
186
187
void
setTitle(
const
Common::String
&text,
int
x,
int
y);
188
189
private
:
190
MenuItemList _items;
191
MenuItemList::iterator
_selected;
192
bool
_closed;
193
Common::String
_title;
194
int
_titleX, _titleY;
195
};
196
197
}
// End of namespace Ultima4
198
}
// End of namespace Ultima
199
200
#endif
Common::String
Definition:
str.h:59
Ultima::Ultima4::MenuEvent
Definition:
menu.h:36
Common::List< MenuItem * >
Ultima::Ultima4::TextView
Definition:
textview.h:41
Ultima
Definition:
detection.h:27
Ultima::Ultima4::Menu
Definition:
menu.h:71
Ultima::Ultima4::MenuItem
Definition:
menuitem.h:46
Common::Point
Definition:
rect.h:144
Ultima::Ultima4::Observable
Definition:
observable.h:45
Common::ListInternal::Iterator
Definition:
list_intern.h:54
engines
ultima
ultima4
views
menu.h
Generated on Wed Sep 9 2026 09:08:48 for ScummVM API documentation by
1.8.13