Crazy Eddies GUI System
0.7.0
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
55
static
const
String
EventClicked
;
56
57
58
/*************************************************************************
59
Accessor type functions
60
*************************************************************************/
68
bool
isHovering
(
void
)
const
{
return
d_hovering;}
69
70
78
bool
isPushed
(
void
)
const
{
return
d_pushed;}
79
80
85
bool
isOpened
(
void
)
const
{
return
d_opened;}
86
87
95
PopupMenu
*
getPopupMenu
(
void
)
const
{
return
d_popup;}
96
97
98
/*************************************************************************
99
Manipulators
100
*************************************************************************/
111
void
setPopupMenu(
PopupMenu
* popup);
112
113
121
void
openPopupMenu(
bool
notify=
true
);
122
123
134
void
closePopupMenu(
bool
notify=
true
);
135
136
144
bool
togglePopupMenu(
void
);
145
146
147
/*************************************************************************
148
Construction and Destruction
149
*************************************************************************/
154
MenuItem
(
const
String
& type,
const
String
& name);
155
156
161
virtual
~
MenuItem
(
void
);
162
163
164
protected
:
165
/*************************************************************************
166
New Event Handlers
167
*************************************************************************/
172
virtual
void
onClicked(
WindowEventArgs
& e);
173
174
175
/*************************************************************************
176
Overridden event handlers
177
*************************************************************************/
178
virtual
void
onMouseMove(
MouseEventArgs
& e);
179
virtual
void
onMouseButtonDown(
MouseEventArgs
& e);
180
virtual
void
onMouseButtonUp(
MouseEventArgs
& e);
181
virtual
void
onCaptureLost(
WindowEventArgs
& e);
182
virtual
void
onMouseLeaves(
MouseEventArgs
& e);
183
virtual
void
onTextChanged(
WindowEventArgs
& e);
184
185
186
/*************************************************************************
187
Implementation Functions
188
*************************************************************************/
199
void
updateInternalState(
const
Point
& mouse_pos);
200
201
209
void
closeAllMenuItemPopups();
210
211
222
void
setPopupMenu_impl(
PopupMenu
* popup,
bool
add_as_child=
true
);
223
224
235
virtual
bool
testClassName_impl(
const
String
& class_name)
const
236
{
237
if
(class_name==
"MenuItem"
)
return
true
;
238
return
ItemEntry::testClassName_impl
(class_name);
239
}
240
241
242
/*************************************************************************
243
Implementation Data
244
*************************************************************************/
245
bool
d_pushed
;
246
bool
d_hovering
;
247
bool
d_opened
;
248
249
PopupMenu
*
d_popup
;
250
251
bool
d_popupWasClosed
;
252
253
254
private
:
255
/*************************************************************************
256
Private methods
257
*************************************************************************/
258
void
addMenuItemProperties(
void
);
259
260
265
virtual
void
addChild_impl(
Window
* wnd);
266
};
267
268
}
// End of CEGUI namespace section
269
270
#endif // end of guard _CEGUIMenuItem_h_
Generated by
1.8.3.1