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
eventresponder.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 __EVENTRESPONDER_H__
23
#define __EVENTRESPONDER_H__
24
25
//See cpp file for detailed descriptions of classes, functions, etc.
26
27
#include "
guidefs.h
"
28
#include <string>
29
30
//The type of a command
31
typedef
std::string
EventCommandId
;
32
33
//Forward reference
34
class
Control
;
35
36
//The EventResponder class is a virtual base class that allows objects
37
//to intercept and respond to input and command events. This class is
38
//used in conjunction with the EventManager.
39
40
class
EventResponder
41
{
42
public
:
43
//PROCESS COMMAND
44
//Process a command event.
45
virtual
bool
processCommand
(
const
EventCommandId
&command,
Control
*control );
46
47
//PROCESS KEYBOARD
48
//Process a key pressed down.
49
virtual
bool
processKeyDown
(
const
InputEvent
&event );
50
51
//Process a key released.
52
virtual
bool
processKeyUp
(
const
InputEvent
&event );
53
54
//PROCESS MOUSE
55
//Process a mouse button pressed down.
56
virtual
bool
processMouseDown
(
const
InputEvent
&event );
57
58
//Called for every click except those landing on the control.
59
virtual
void
processUnfocus
(
const
InputEvent
&event );
60
61
//Process a mouse button released.
62
virtual
bool
processMouseUp
(
const
InputEvent
&event );
63
64
//Process a mouse location change.
65
virtual
bool
processMouseMove
(
const
InputEvent
&event );
66
67
//Process a mouse location change when at least one mouse button is down.
68
virtual
bool
processMouseDrag
(
const
InputEvent
&event );
69
70
//CODE-GENERATED EVENTS.
71
//Send a command event into the event chain.
72
virtual
void
sendCommand
(
const
EventCommandId
&command,
Control
*control );
73
74
//Set a specified target for commands. Commands aren't forwarded into the
75
//event chain, they are sent to this specific target. This can be used, for
76
//instance, to tie two controls tightly together.
77
//Use NULL to clear the target and forward commands into the event chain.
78
virtual
void
setCommandTarget
(
EventResponder
*responder );
79
80
//BEHAVIOR
81
//Handle all input events. Don't forward anything down the event chain.
82
virtual
void
setModal
(
bool
modal );
83
84
//CONSTRUCTION
85
public
:
EventResponder
(
void
);
86
virtual
~EventResponder
(
void
);
87
88
//VARIABLES
89
protected
:
90
bool
m_modal
;
//true = This window "traps" all events -- events don't go to other windows.
91
EventResponder
*
m_commandTarget
;
//Forward events to this particular responder, not the event chain.
92
};
93
94
#endif //__EVENTRESPONDER_H__
95
src
gui
eventresponder.h
Generated on Fri May 29 2015 23:07:32 for Vegastrike 0.5.1 rc1 by
1.8.4