Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
navcomputer.h
Go to the documentation of this file.
1
/*
2
* Vega Strike
3
* Copyright (C) 2003 Mike Byron
4
*
5
* http://vegastrike.sourceforge.net/
6
*
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 2
10
* of the License, or (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, write to the Free Software
19
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
*/
21
22
#ifndef __NAVCOMPUTER_H__
23
#define __NAVCOMPUTER_H__
24
25
#include "
navscreen.h
"
26
#include "
navpath.h
"
27
#include "
gui/windowcontroller.h
"
28
#include "
gui/simplepicker.h
"
29
30
class
PathManager
;
31
class
NavigationSystem
;
32
33
//The NavComputer class displays an interactive screen that supports a
34
//number of function.
35
//Current list:
36
//Setting descriptor seacrhes
37
class
NavComputer
:
public
WindowController
38
{
39
public
:
40
//The Computer displays that are possible.
41
enum
DisplayMode
42
{
43
LIST
=0,
//
44
EDIT
,
//
45
DISPLAY_MODE_COUNT
,
//Number of display modes.
46
NULL_DISPLAY
=
DISPLAY_MODE_COUNT
,
//No display.
47
};
48
49
enum
SelectorMode
50
{
51
TARGET
=0,
//
52
CRITERIA
,
//
53
CHAIN
,
//
54
SELECTOR_MODE_COUNT
,
//Number of display modes.
55
NULL_SELECTOR
=
SELECTOR_MODE_COUNT
,
//No display.
56
};
57
58
//Set up the window and get everything ready.
59
virtual
void
init
(
void
);
60
61
//Start it up!
62
virtual
void
run
(
void
);
63
64
//Process a command event from the window.
65
virtual
bool
processWindowCommand
(
const
EventCommandId
&command,
Control
*control );
66
67
//CONSTRUCTION
68
NavComputer
(
NavigationSystem
*navsystem );
69
virtual
~NavComputer
(
void
);
70
71
protected
:
72
/***********************************************************************
73
* *
74
* Inner class to confirm choices *
75
* *
76
************************************************************************/
77
78
class
RenameConfirm
:
public
WindowController
79
{
80
NavComputer
*m_parent;
81
82
public
:
83
//CONSTRUCTION.
84
RenameConfirm
(
NavComputer
*player ) : m_parent( player ) {}
85
virtual
~RenameConfirm
(
void
) {}
86
87
//Set up the window and get everything ready.
88
virtual
void
init
(
void
);
89
90
//Process a command event from the window.
91
virtual
bool
processWindowCommand
(
const
EventCommandId
&command,
Control
*control );
92
};
93
friend
class
RenameConfirm
;
94
95
/***********************************************************************
96
* *
97
* Sets up the window *
98
* *
99
************************************************************************/
100
101
//Gets the color to be used for each control group
102
GFXColor
getColorForGroup
( std::string
id
);
103
//Create the controls that will be used for this window.
104
void
createControls
(
void
);
105
//Contruct the controls in code.
106
void
constructControls
(
void
);
107
108
//Toggles the navcomputer's visibility
109
bool
toggleVisibility
(
const
EventCommandId
&command,
Control
*control );
110
111
/***********************************************************************
112
* *
113
* Functions to switch between modes *
114
* *
115
************************************************************************/
116
117
//Change display mode to LIST
118
bool
changeToListMode
(
const
EventCommandId
&command,
Control
*control );
119
//Change display mode to EDIT
120
bool
changeToEditMode
(
const
EventCommandId
&command,
Control
*control );
121
//Change display mode to TARGET
122
bool
changeToTargetMode
(
const
EventCommandId
&command,
Control
*control );
123
//Change display mode to STRING
124
bool
changeToCriteriaMode
(
const
EventCommandId
&command,
Control
*control );
125
//Change display mode to CHAIN
126
bool
changeToChainMode
(
const
EventCommandId
&command,
Control
*control );
127
128
//Redo the title string.
129
void
recalcTitle
(
void
);
130
//Switch to the set of controls used for the specified mode.
131
void
switchToMajorControls
(
DisplayMode
mode );
132
//Switch to the set of controls used for the specified mode.
133
void
switchToMinorControls
(
SelectorMode
mode );
134
135
/************************************************************************
136
* *
137
* Control Functions *
138
* *
139
************************************************************************/
140
141
void
loadPathLister
();
142
void
loadChainLister
();
143
void
loadCriteriaLister
();
144
void
loadCriteriaPickerCell
(
SimplePicker
*picker,
ValuedPickerCell< CriteriaNode* >
*parent,
CriteriaNode
*node );
145
void
loadAbsoluteButton
();
146
bool
setCurrentNode
(
PathNode
*source = NULL );
147
void
updateDescription
();
148
void
updateNodeDescription
();
149
150
bool
pathListerChangedSelection
(
const
EventCommandId
&command,
Control
*control );
151
bool
chainListerChangedSelection
(
const
EventCommandId
&command,
Control
*control );
152
153
bool
actionAdd
(
const
EventCommandId
&command,
Control
*control );
154
bool
actionShowPath
(
const
EventCommandId
&command,
Control
*control );
155
bool
actionRename
(
const
EventCommandId
&command,
Control
*control );
156
bool
actionRemove
(
const
EventCommandId
&command,
Control
*control );
157
bool
actionShowAll
(
const
EventCommandId
&command,
Control
*control );
158
bool
actionShowNone
(
const
EventCommandId
&command,
Control
*control );
159
bool
actionSource
(
const
EventCommandId
&command,
Control
*control );
160
bool
actionDestination
(
const
EventCommandId
&command,
Control
*control );
161
bool
actionApply
(
const
EventCommandId
&command,
Control
*control );
162
bool
actionCurrent
(
const
EventCommandId
&command,
Control
*control );
163
bool
actionTarget
(
const
EventCommandId
&command,
Control
*control );
164
bool
actionAbsolute
(
const
EventCommandId
&command,
Control
*control );
165
bool
actionAnd
(
const
EventCommandId
&command,
Control
*control );
166
bool
actionOr
(
const
EventCommandId
&command,
Control
*control );
167
bool
actionNot
(
const
EventCommandId
&command,
Control
*control );
168
bool
actionRemoveCriteria
(
const
EventCommandId
&command,
Control
*control );
169
bool
actionChain
(
const
EventCommandId
&command,
Control
*control );
170
171
void
actionRenameConfirmed
( std::string name );
172
173
/***********************************************************************
174
* *
175
* Table to store command-function relationships *
176
* *
177
************************************************************************/
178
179
//Dispatch table declarations.
180
//This is a member table so the handler functions don't need to be public.
181
typedef
bool
(
NavComputer
::*
WCtlHandler
)(
const
EventCommandId
&command,
Control
*control );
182
struct
WctlTableEntry
183
{
184
EventCommandId
command
;
185
std::string
controlId
;
186
WCtlHandler
function
;
187
WctlTableEntry
(
const
EventCommandId
&cmd,
const
std::string &cid,
const
WCtlHandler
&func ) :
188
command
( cmd )
189
,
controlId
( cid )
190
,
function
( func ) {}
191
};
192
static
const
WctlTableEntry
WctlCommandTable
[];
193
194
/***********************************************************************
195
* *
196
* Feature Member variables *
197
* *
198
************************************************************************/
199
200
//VARIABLES
201
NavigationSystem
*
navsys
;
//The navigation system to interface with
202
PathManager
*
pathman
;
//The path manager to interface with
203
204
NavPath
*
currentPath
;
//The currently selected path
205
PathNode
*
currentNode
;
//The currently edited node
206
bool
criteria
;
//The currently selected node is a criteria node
207
208
/***********************************************************************
209
* *
210
* Inner Member variables *
211
* *
212
************************************************************************/
213
214
//VARIABLES
215
bool
m_visible
;
216
vector< DisplayMode >
m_displayModes
;
//List of displays to provide.
217
vector< SelectorMode >
m_selectorModes
;
//List of selectors to provide.
218
DisplayMode
m_currentDisplay
;
//The current display mode.
219
SelectorMode
m_currentSelector
;
//The current selector mode.
220
Control
*
m_displayModeGroups
[
DISPLAY_MODE_COUNT
];
//Array of GroupControls, one for each display mode.
221
Control
*
m_selectorModeGroups
[
SELECTOR_MODE_COUNT
];
//Array of GroupControls, one for each selector mode.
222
};
223
224
#endif //__NAVCOMPUTER_H__
225
src
gfx
nav
navcomputer.h
Generated on Fri May 29 2015 23:07:26 for Vegastrike 0.5.1 rc1 by
1.8.4