-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathuimenu_SetupMenu.cpp
More file actions
134 lines (102 loc) · 3.66 KB
/
uimenu_SetupMenu.cpp
File metadata and controls
134 lines (102 loc) · 3.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*
Copyright (C) 2007 Benjamin Litzelmann
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "uicore_Global.h"
#include "uimenu_SetupMenu.h"
#include "uiwsw_Export.h"
#include "uiwsw_SysCalls.h"
#include "uiwsw_Utils.h"
#include "uimenu_SetupPlayerMenu.h"
#include "uimenu_SetupSoundMenu.h"
#include "uimenu_SetupGraphicsMenu.h"
using namespace UICore;
using namespace UIMenu;
using namespace UIWsw;
extern SetupPlayerMenu *setupplayer;
extern SetupSoundMenu *setupsounds;
extern SetupGraphicsMenu *setupgraphics;
SetupMenu *setupmenu = NULL;
void UIMenu::M_Menu_Setup_f( void )
{
if ( !setupmenu )
setupmenu = new SetupMenu();
setupmenu->Show();
}
void SetupMenu::playerHandler( BaseObject* )
{
setupmenu->currentSubPanel->setVisible( false );
Trap::Cmd_ExecuteText( EXEC_APPEND, "menu_playersetup" );
}
void SetupMenu::controllerHandler( BaseObject* )
{
}
void SetupMenu::graphicsHandler( BaseObject* )
{
setupmenu->currentSubPanel->setVisible( false );
Trap::Cmd_ExecuteText( EXEC_APPEND, "menu_graphics" );
}
void SetupMenu::soundsHandler( BaseObject* )
{
setupmenu->currentSubPanel->setVisible( false );
Trap::Cmd_ExecuteText( EXEC_APPEND, "menu_sound" );
}
void SetupMenu::ircHandler( BaseObject* )
{
}
void SetupMenu::mainmenuHandler( BaseObject* )
{
if ( setupplayer )
setupplayer->UpdatePlayerConfig();
if ( setupsounds )
setupsounds->UpdateSoundConfig();
if ( setupgraphics )
setupgraphics->UpdateGraphicsConfig();
Trap::Cmd_ExecuteText( EXEC_APPEND, "menu_main" );
}
ALLOCATOR_DEFINITION(SetupMenu)
DELETER_DEFINITION(SetupMenu)
SetupMenu::SetupMenu() : MainMenu( "Game Settings" )
{
int yoffset = 0;
panel = Factory::newPanel( contentPanel, 0, 0, contentPanel->getWidth(), contentPanel->getHeight() );
panel->setBorderWidth( 1 );
player = Factory::newButton( panel, 20, yoffset += 150, 150, 30, "PLAYER" );
player->setClickHandler( playerHandler );
controller = Factory::newButton( panel, 20, yoffset += 40, 150, 30, "CONTROLLER" );
controller->setClickHandler( controllerHandler );
graphics = Factory::newButton( panel, 20, yoffset += 40, 150, 30, "GRAPHICS" );
graphics->setClickHandler( graphicsHandler );
sounds = Factory::newButton( panel, 20, yoffset += 40, 150, 30, "SOUNDS" );
sounds->setClickHandler( soundsHandler );
irc = Factory::newButton( panel, 20, yoffset += 40, 150, 30, "IRC" );
irc->setClickHandler( ircHandler );
mainmenu = Factory::newButton( panel, 20, yoffset += 60, 150, 30, "MAIN MENU" );
mainmenu->setClickHandler( mainmenuHandler );
subpanel = Factory::newPanel( panel, 200, 20, 540, 520 );
selectcat = Factory::newLabel( subpanel, 0, 250, 540, 20, "Select a category" );
selectcat->setAlign( ALIGN_MIDDLE_CENTER );
currentSubPanel = subpanel;
}
void SetupMenu::Show( void )
{
currentSubPanel = subpanel;
setActiveMenu( this );
panel->setVisible( true );
MainMenu::Show();
}
void SetupMenu::Hide( void )
{
MainMenu::Hide();
panel->setVisible( false );
}