OpenMoHAA
0.82.1
Loading...
Searching...
No Matches
uibutton.h
1
/*
2
===========================================================================
3
Copyright (C) 2024 the OpenMoHAA team
4
5
This file is part of OpenMoHAA source code.
6
7
OpenMoHAA source code is free software; you can redistribute it
8
and/or modify it under the terms of the GNU General Public License as
9
published by the Free Software Foundation; either version 2 of the License,
10
or (at your option) any later version.
11
12
OpenMoHAA source code is distributed in the hope that it will be
13
useful, 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 OpenMoHAA source code; if not, write to the Free Software
19
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
===========================================================================
21
*/
22
23
#pragma once
24
25
extern
Event
W_Button_Pressed;
26
27
class
UIButtonBase :
public
UIWidget
28
{
29
protected
:
30
mouseState_t m_mouseState;
31
str
m_hoverSound;
32
str
m_hoverCommand;
33
str
m_mouseExitedCommand;
34
35
public
:
36
CLASS_PROTOTYPE(UIButtonBase);
37
38
protected
:
39
void
Pressed(
Event
*ev);
40
void
Released(
Event
*ev);
41
void
MouseEntered(
Event
*ev);
42
void
MouseExited(
Event
*ev);
43
void
Dragged(
Event
*ev);
44
void
SetHoverSound(
Event
*ev);
45
void
SetHoverCommand(
Event
*ev);
46
void
SetMouseExitedCommand(
Event
*ev);
47
48
public
:
49
UIButtonBase();
50
51
void
Action(
void
);
52
};
53
54
class
UIButton :
public
UIButtonBase
55
{
56
public
:
57
CLASS_PROTOTYPE(UIButton);
58
59
private
:
60
void
Draw(
void
)
override
;
61
virtual
void
DrawPressed(
void
);
62
virtual
void
DrawUnpressed(
void
);
63
64
public
:
65
UIButton();
66
67
qboolean KeyEvent(
int
key,
unsigned
int
time)
override
;
68
};
69
70
class
ToggleCVar :
public
USignal
71
{
72
protected
:
73
str
m_cvarname;
74
UIButton
*m_button;
75
76
protected
:
77
CLASS_PROTOTYPE(ToggleCVar);
78
79
void
Press(
Event
*ev);
80
81
public
:
82
ToggleCVar();
83
ToggleCVar(
UIButton
*button,
const
char
*cvar);
84
85
void
setCVar(
const
char
*cvar);
86
void
setButton(
UIButton
*button);
87
};
88
89
class
ExecCmd :
public
USignal
90
{
91
protected
:
92
UIButton
*m_button;
93
str
m_cmd;
94
95
public
:
96
CLASS_PROTOTYPE(ExecCmd);
97
98
protected
:
99
void
Press(
Event
*ev);
100
101
public
:
102
ExecCmd();
103
ExecCmd(
UIButton
*button,
const
char
*cmd);
104
105
void
setCommand(
const
char
*cmd);
106
void
setButton(
UIButton
*button);
107
};
Event
Definition
listener.h:246
UIButton
Definition
uibutton.h:55
USignal
Definition
usignal.h:44
str
Definition
str.h:77
code
uilib
uibutton.h
Generated by
1.13.2