ScummVM API documentation
menuitem.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_MENUITEM_H
23
#define ULTIMA4_VIEWS_MENUITEM_H
24
25
#include "common/str.h"
26
#include "ultima/shared/std/containers.h"
27
28
namespace
Ultima
{
29
namespace
Ultima4 {
30
31
class
MenuEvent;
32
38
enum
menuOutputType {
39
MENU_OUTPUT_INT,
40
MENU_OUTPUT_GAMMA,
41
MENU_OUTPUT_SHRINE,
42
MENU_OUTPUT_SPELL,
43
MENU_OUTPUT_VOLUME,
44
MENU_OUTPUT_REAGENT
45
};
46
47
class
MenuItem
{
48
public
:
52
MenuItem
(
const
Common::String
&text,
short
x,
short
y,
int
shortcutKey = -1);
53
virtual
~
MenuItem
() {}
54
55
virtual
void
activate(
MenuEvent
&event) {}
56
57
// Accessor Methods
58
int
getId()
const
;
59
short
getX()
const
;
60
short
getY()
const
;
61
int
getScOffset()
const
;
62
63
virtual
Common::String
getText()
const
;
64
bool
isHighlighted()
const
;
65
bool
isSelected()
const
;
66
bool
isVisible()
const
;
67
const
Std::set<int>
&getShortcutKeys()
const
;
68
bool
getClosesMenu()
const
;
69
70
void
setId(
int
id
);
71
void
setX(
int
x);
72
void
setY(
int
y);
73
void
setText(
const
Common::String
&text);
74
void
setHighlighted(
bool
h =
true
);
75
void
setSelected(
bool
s =
true
);
76
void
setVisible(
bool
v =
true
);
77
void
addShortcutKey(
int
shortcutKey);
78
void
setClosesMenu(
bool
closesMenu);
79
80
protected
:
81
int
_id;
82
short
_x, _y;
83
Common::String
_text;
84
bool
_highlighted;
85
bool
_selected;
86
bool
_visible;
87
int
_scOffset;
88
Std::set<int>
_shortcutKeys;
89
bool
_closesMenu;
90
};
91
96
class
BoolMenuItem
:
public
MenuItem
{
97
public
:
98
BoolMenuItem
(
const
Common::String
&text,
short
xp,
short
yp,
int
shortcutKey,
bool
*val);
99
100
BoolMenuItem
*setValueStrings(
const
Common::String
&onString,
const
Common::String
&offString);
101
102
void
activate(
MenuEvent
&event)
override
;
103
Common::String
getText()
const override
;
104
105
protected
:
106
bool
*_val;
107
Common::String
_on, _off;
108
};
109
114
class
StringMenuItem
:
public
MenuItem
{
115
public
:
116
StringMenuItem
(
const
Common::String
&text,
short
xp,
short
yp,
int
shortcutKey,
Common::String
*val,
const
Std::vector<Common::String>
&validSettings);
117
118
void
activate(
MenuEvent
&event)
override
;
119
Common::String
getText()
const override
;
120
121
protected
:
122
Common::String
*_val;
123
Std::vector<Common::String>
_validSettings;
124
};
125
130
class
IntMenuItem
:
public
MenuItem
{
131
public
:
132
IntMenuItem
(
const
Common::String
&text,
short
xp,
short
yp,
int
shortcutKey,
int
*val,
int
min,
int
max,
int
increment, menuOutputType output = MENU_OUTPUT_INT);
133
134
void
activate(
MenuEvent
&event)
override
;
135
Common::String
getText()
const override
;
136
137
protected
:
138
int
*_val;
139
int
_min, _max, _increment;
140
menuOutputType _output;
141
};
142
143
}
// End of namespace Ultima4
144
}
// End of namespace Ultima
145
146
#endif
Ultima::Std::set< int >
Common::String
Definition:
str.h:59
Ultima::Ultima4::BoolMenuItem
Definition:
menuitem.h:96
Ultima::Ultima4::MenuEvent
Definition:
menu.h:37
Ultima
Definition:
detection.h:27
Ultima::Ultima4::MenuItem
Definition:
menuitem.h:47
Ultima::Ultima4::IntMenuItem
Definition:
menuitem.h:130
Ultima::Ultima4::StringMenuItem
Definition:
menuitem.h:114
Ultima::Std::vector< Common::String >
Ultima::Ultima4::MenuItem::MenuItem
MenuItem(const Common::String &text, short x, short y, int shortcutKey=-1)
engines
ultima
ultima4
views
menuitem.h
Generated on Mon Dec 23 2024 09:21:39 for ScummVM API documentation by
1.8.13