OpenMoHAA
0.82.0
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
protected
:
29
mouseState_t m_mouseState;
30
str
m_hoverSound;
31
str
m_hoverCommand;
32
str
m_mouseExitedCommand;
33
34
public
:
35
CLASS_PROTOTYPE( UIButtonBase );
36
37
protected
:
38
void
Pressed(
Event
*ev );
39
void
Released(
Event
*ev );
40
void
MouseEntered(
Event
*ev );
41
void
MouseExited(
Event
*ev );
42
void
Dragged(
Event
*ev );
43
void
SetHoverSound(
Event
*ev );
44
void
SetHoverCommand(
Event
*ev );
45
void
SetMouseExitedCommand(
Event
*ev );
46
47
public
:
48
UIButtonBase();
49
50
void
Action(
void
);
51
};
52
53
class
UIButton :
public
UIButtonBase {
54
public
:
55
CLASS_PROTOTYPE( UIButton );
56
57
private
:
58
void
Draw(
void
)
override
;
59
virtual
void
DrawPressed(
void
);
60
virtual
void
DrawUnpressed(
void
);
61
62
public
:
63
UIButton();
64
65
qboolean KeyEvent(
int
key,
unsigned
int
time )
override
;
66
};
67
68
class
ToggleCVar :
public
USignal
{
69
protected
:
70
str
m_cvarname;
71
UIButton
*m_button;
72
73
protected
:
74
CLASS_PROTOTYPE( ToggleCVar );
75
76
void
Press(
Event
*ev );
77
78
public
:
79
ToggleCVar();
80
ToggleCVar(
UIButton
*button,
const
char
*cvar );
81
82
void
setCVar(
const
char
*cvar );
83
void
setButton(
UIButton
*button );
84
};
85
86
class
ExecCmd :
public
USignal
{
87
protected
:
88
UIButton
*m_button;
89
str
m_cmd;
90
91
public
:
92
CLASS_PROTOTYPE( ExecCmd );
93
94
protected
:
95
void
Press(
Event
*ev );
96
97
public
:
98
ExecCmd();
99
ExecCmd(
UIButton
*button,
const
char
*cmd );
100
101
void
setCommand(
const
char
*cmd );
102
void
setButton(
UIButton
*button );
103
};
Event
Definition
listener.h:246
UIButton
Definition
uibutton.h:53
USignal
Definition
usignal.h:42
str
Definition
str.h:77
code
uilib
uibutton.h
Generated by
1.13.2