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
eventmanager.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 __EVENTMANAGER_H__
23
#define __EVENTMANAGER_H__
24
25
#include "
eventresponder.h
"
26
27
#include <vector>
28
29
//See cpp file for detailed descriptions of classes, functions, etc.
30
31
/* The EventManager class contains the basic event loop and the code
32
* to support the EventResponder chain. There should be only one
33
* instance of this class running in an application.
34
* You can get a pointer to it by using the static globalEventManager()
35
* function.
36
*/
37
class
EventManager
38
{
39
public
:
40
//Use this instead of deleting, because other events that happen at the
41
//same time may delete the same object.
42
static
void
addToDeleteQueue
(
EventResponder
*controlToDelete );
43
//STATIC: Initialize the event manager. This starts the event loop, etc.
44
//This may be called more than once -- it does nothing after the
45
//first call.
46
static
void
initializeEventManager
(
void
);
47
48
//Add a new event responder to the top of the chain.
49
//This responder will get events *first*.
50
void
pushResponder
(
EventResponder
*responder );
51
52
//Remove an event responder from the chain.
53
//"all" = True means get rid of all instances of the responder in the chain.
54
//False means get rid of the topmost one only.
55
void
removeResponder
(
EventResponder
*responder,
bool
top =
false
);
56
57
//Send a command through the responder chain.
58
void
sendCommand
(
const
EventCommandId
&
id
,
Control
*control );
59
60
//Get the current mouse position.
61
Point
mouseLoc
(
void
)
62
{
63
return
m_mouseLoc
;
64
}
65
66
protected
:
67
//CONSTRUCTION
68
//Constructor isn't public. Use initializeEventManager.
69
EventManager
(
void
);
70
virtual
~EventManager
(
void
);
71
72
//INTERNAL IMPLEMENTATION
73
//Send an input event through the responder chain.
74
void
sendInputEvent
(
const
InputEvent
&event );
75
76
//DATA
77
std::vector< EventResponder* >
m_responders
;
//Stack of responders for events.
78
Point
m_mouseLoc
;
//Current mouse point.
79
80
//HACKS FOR WORKING WITH CURRENT EVENT SYSTEM
81
void
checkForShutDownEventManager
(
void
);
//Called to revert to old event management.
82
void
takeOverEventManagement
(
void
);
//Called to grab event management from old system.
83
public
:
84
85
static
void
ProcessMouseClick
(
int
button,
int
state,
int
x
,
int
y
);
86
static
void
ProcessMouseActive
(
int
x
,
int
y
);
87
static
void
ProcessMousePassive
(
int
x
,
int
y
);
88
};
89
90
//Get the global instance of the event manager
91
EventManager
&
globalEventManager
(
void
);
92
bool
hasGlobalEventManager
(
void
);
93
94
#endif //__EVENTMANAGER_H__
95
src
gui
eventmanager.h
Generated on Fri May 29 2015 23:07:32 for Vegastrike 0.5.1 rc1 by
1.8.4