Crazy Eddies GUI System
0.7.2
Main Page
Related Pages
Namespaces
Classes
Files
File List
cegui
include
elements
CEGUIMenuItem.h
1
/***********************************************************************
2
filename: CEGUIMenuItem.h
3
created: 2/4/2005
4
author: Tomas Lindquist Olsen (based on code by Paul D Turner)
5
6
purpose: Interface to base class for MenuItem widget
7
*************************************************************************/
8
/***************************************************************************
9
* Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
10
*
11
* Permission is hereby granted, free of charge, to any person obtaining
12
* a copy of this software and associated documentation files (the
13
* "Software"), to deal in the Software without restriction, including
14
* without limitation the rights to use, copy, modify, merge, publish,
15
* distribute, sublicense, and/or sell copies of the Software, and to
16
* permit persons to whom the Software is furnished to do so, subject to
17
* the following conditions:
18
*
19
* The above copyright notice and this permission notice shall be
20
* included in all copies or substantial portions of the Software.
21
*
22
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
26
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28
* OTHER DEALINGS IN THE SOFTWARE.
29
***************************************************************************/
30
#ifndef _CEGUIMenuItem_h_
31
#define _CEGUIMenuItem_h_
32
33
#include "../CEGUIBase.h"
34
#include "../CEGUIWindow.h"
35
#include "CEGUIItemEntry.h"
36
37
// Start of CEGUI namespace section
38
namespace
CEGUI
39
{
40
45
class
CEGUIEXPORT
MenuItem
:
public
ItemEntry
46
{
47
public
:
48
static
const
String
EventNamespace
;
49
static
const
String
WidgetTypeName
;
50
51
/*************************************************************************
52
Event name constants
53
*************************************************************************/
54
// generated internally by Window
59
static
const
String
EventClicked
;
60
61
62
/*************************************************************************
63
Accessor type functions
64
*************************************************************************/
72
bool
isHovering
(
void
)
const
{
return
d_hovering;}
73
74
82
bool
isPushed
(
void
)
const
{
return
d_pushed;}
83
84
89
bool
isOpened
(
void
)
const
{
return
d_opened;}
90
91
99
PopupMenu
*
getPopupMenu
(
void
)
const
{
return
d_popup;}
100
101
102
/*************************************************************************
103
Manipulators
104
*************************************************************************/
115
void
setPopupMenu(
PopupMenu
* popup);
116
117
125
void
openPopupMenu(
bool
notify=
true
);
126
127
138
void
closePopupMenu(
bool
notify=
true
);
139
140
148
bool
togglePopupMenu(
void
);
149
150
151
/*************************************************************************
152
Construction and Destruction
153
*************************************************************************/
158
MenuItem
(
const
String
& type,
const
String
& name);
159
160
165
virtual
~
MenuItem
(
void
);
166
167
168
protected
:
169
/*************************************************************************
170
New Event Handlers
171
*************************************************************************/
176
virtual
void
onClicked(
WindowEventArgs
& e);
177
178
179
/*************************************************************************
180
Overridden event handlers
181
*************************************************************************/
182
virtual
void
onMouseMove(
MouseEventArgs
& e);
183
virtual
void
onMouseButtonDown(
MouseEventArgs
& e);
184
virtual
void
onMouseButtonUp(
MouseEventArgs
& e);
185
virtual
void
onCaptureLost(
WindowEventArgs
& e);
186
virtual
void
onMouseLeaves(
MouseEventArgs
& e);
187
virtual
void
onTextChanged(
WindowEventArgs
& e);
188
189
190
/*************************************************************************
191
Implementation Functions
192
*************************************************************************/
203
void
updateInternalState(
const
Point
& mouse_pos);
204
205
213
void
closeAllMenuItemPopups();
214
215
226
void
setPopupMenu_impl(
PopupMenu
* popup,
bool
add_as_child=
true
);
227
228
239
virtual
bool
testClassName_impl(
const
String
& class_name)
const
240
{
241
if
(class_name==
"MenuItem"
)
return
true
;
242
return
ItemEntry::testClassName_impl
(class_name);
243
}
244
245
246
/*************************************************************************
247
Implementation Data
248
*************************************************************************/
249
bool
d_pushed
;
250
bool
d_hovering
;
251
bool
d_opened
;
252
253
PopupMenu
*
d_popup
;
254
255
bool
d_popupWasClosed
;
256
257
258
private
:
259
/*************************************************************************
260
Private methods
261
*************************************************************************/
262
void
addMenuItemProperties(
void
);
263
264
269
virtual
void
addChild_impl(
Window
* wnd);
270
};
271
272
}
// End of CEGUI namespace section
273
274
#endif // end of guard _CEGUIMenuItem_h_
Generated by
1.8.3.1