Crazy Eddie's GUI System  0.8.4
CEGUI::MenuItem Class Reference

Base class for menu items. More...

+ Inheritance diagram for CEGUI::MenuItem:
+ Collaboration diagram for CEGUI::MenuItem:

List of all members.

Public Member Functions

bool isHovering (void) const
 return true if user is hovering over this widget (or it's pushed and user is not over it for highlight)
bool isPushed (void) const
 Return true if the button widget is in the pushed state.
bool isOpened (void) const
 Returns true if the popup menu attached to the menu item is open.
bool isPopupClosing (void) const
 Returns true if the menu item popup is closing or not.
bool hasAutoPopup (void) const
 Returns true if the menu item popup is closed or opened automatically if hovering with the mouse.
float getAutoPopupTimeout (void) const
 Returns the time, which has to elapse before the popup window is opened/closed if the hovering state changes.
void setAutoPopupTimeout (float time)
 Sets the time, which has to elapse before the popup window is opened/closed if the hovering state changes.
PopupMenugetPopupMenu (void) const
 Get the PopupMenu that is currently attached to this MenuItem.
const UVector2getPopupOffset (void) const
 Returns the current offset for popup placement.
void setPopupOffset (const UVector2 &popupOffset)
 sets the current offset for popup placement.
void setPopupMenu (PopupMenu *popup)
 Set the popup menu for this item.
void openPopupMenu (bool notify=true)
 Opens the PopupMenu.
void closePopupMenu (bool notify=true)
 Closes the PopupMenu.
bool togglePopupMenu (void)
 Toggles the PopupMenu.
void startPopupClosing (void)
 starts the closing timer for the popup, which will close it if the timer is enabled.
void startPopupOpening (void)
 starts the opening timer for the popup, which will open it if the timer is enabled.
 MenuItem (const String &type, const String &name)
 Constructor for MenuItem objects.
virtual ~MenuItem (void)
 Destructor for MenuItem objects.

Static Public Attributes

static const String EventNamespace
 Namespace for global events.
static const String WidgetTypeName
 Window factory name.
static const String EventClicked

Protected Member Functions

virtual void onClicked (WindowEventArgs &e)
 handler invoked internally when the MenuItem is clicked.
virtual void onMouseMove (MouseEventArgs &e)
 Handler called when the mouse cursor has been moved within this window's area.
virtual void onMouseButtonDown (MouseEventArgs &e)
 Handler called when a mouse button has been depressed within this window's area.
virtual void onMouseButtonUp (MouseEventArgs &e)
 Handler called when a mouse button has been released within this window's area.
virtual void onCaptureLost (WindowEventArgs &e)
 Handler called when this window loses capture of mouse inputs.
virtual void onMouseLeaves (MouseEventArgs &e)
 Handler called when the mouse cursor is no longer over this window's surface area. This will be called when the mouse is not over a part of this Window's actual surface - even though technically the mouse is still within the Window's area, for example if the mouse moves over a child window.
virtual void onTextChanged (WindowEventArgs &e)
 Handler called when the window's text is changed.
virtual void updateSelf (float elapsed)
 Perform actual update processing for this Window.
void updateInternalState (const Vector2f &mouse_pos)
 Update the internal state of the widget with the mouse at the given position.
void closeAllMenuItemPopups ()
 Recursive function that closes all popups down the hierarcy starting with this one.
void setPopupMenu_impl (PopupMenu *popup, bool add_as_child=true)
 Set the popup menu for this item.

Protected Attributes

bool d_pushed
 true when widget is pushed
bool d_hovering
 true when the button is in 'hover' state and requires the hover rendering.
bool d_opened
 true when the menu item's popup menu is in its opened state.
bool d_popupClosing
 true when the d_popupTimerTimeElapsed timer is running to close the popup (another menu item of our container is hovered)
bool d_popupOpening
 true when the d_popupTimerTimeElapsed timer is running to open the popup (the menu item is hovered)
float d_autoPopupTimeout
 the time in seconds, to wait before opening / closing the popup if the mouse is over the item / over another item in our container
float d_autoPopupTimeElapsed
 the current time, which is already elapsed if the timer is running (d_popupClosing or d_popupOpening is true)
PopupMenud_popup
 PopupMenu that this item displays when activated.
bool d_popupWasClosed
 Used internally to determine if a popup was just closed on a Clicked event.
UVector2 d_popupOffset
 current offset for popup placement.

Detailed Description

Base class for menu items.


Member Function Documentation

Recursive function that closes all popups down the hierarcy starting with this one.

Returns:
Nothing.
void CEGUI::MenuItem::closePopupMenu ( bool  notify = true)

Closes the PopupMenu.

Parameters:
notifytrue if the parent menubar (if any) is to handle the close.
Returns:
Nothing.
PopupMenu* CEGUI::MenuItem::getPopupMenu ( void  ) const [inline]

Get the PopupMenu that is currently attached to this MenuItem.

Returns:
A pointer to the currently attached PopupMenu. Null is there is no PopupMenu attached.
bool CEGUI::MenuItem::isHovering ( void  ) const [inline]

return true if user is hovering over this widget (or it's pushed and user is not over it for highlight)

Returns:
true if the user is hovering or if the button is pushed and the mouse is not over the button. Otherwise return false.
bool CEGUI::MenuItem::isPushed ( void  ) const [inline]

Return true if the button widget is in the pushed state.

Returns:
true if the button-type widget is pushed, false if the widget is not pushed.
virtual void CEGUI::MenuItem::onCaptureLost ( WindowEventArgs e) [protected, virtual]

Handler called when this window loses capture of mouse inputs.

Parameters:
eWindowEventArgs object whose 'window' pointer field is set to the window that triggered the event. For this event the trigger window is always 'this'.

Reimplemented from CEGUI::Window.

virtual void CEGUI::MenuItem::onMouseButtonDown ( MouseEventArgs e) [protected, virtual]

Handler called when a mouse button has been depressed within this window's area.

Parameters:
eMouseEventArgs object. All fields are valid.

Reimplemented from CEGUI::Window.

virtual void CEGUI::MenuItem::onMouseButtonUp ( MouseEventArgs e) [protected, virtual]

Handler called when a mouse button has been released within this window's area.

Parameters:
eMouseEventArgs object. All fields are valid.

Reimplemented from CEGUI::Window.

virtual void CEGUI::MenuItem::onMouseLeaves ( MouseEventArgs e) [protected, virtual]

Handler called when the mouse cursor is no longer over this window's surface area. This will be called when the mouse is not over a part of this Window's actual surface - even though technically the mouse is still within the Window's area, for example if the mouse moves over a child window.

Parameters:
eMouseEventArgs object. All fields are valid.
See also:
Window::onMouseLeavesArea

Reimplemented from CEGUI::Window.

virtual void CEGUI::MenuItem::onMouseMove ( MouseEventArgs e) [protected, virtual]

Handler called when the mouse cursor has been moved within this window's area.

Parameters:
eMouseEventArgs object. All fields are valid.

Reimplemented from CEGUI::Window.

virtual void CEGUI::MenuItem::onTextChanged ( WindowEventArgs e) [protected, virtual]

Handler called when the window's text is changed.

Parameters:
eWindowEventArgs object whose 'window' pointer field is set to the window that triggered the event. For this event the trigger window is always 'this'.

Reimplemented from CEGUI::Window.

void CEGUI::MenuItem::openPopupMenu ( bool  notify = true)

Opens the PopupMenu.

Parameters:
notifytrue if the parent menu bar or menu popup (if any) is to handle the open.

Set the popup menu for this item.

Parameters:
popuppopupmenu window to attach to this item
Returns:
Nothing.
void CEGUI::MenuItem::setPopupMenu_impl ( PopupMenu popup,
bool  add_as_child = true 
) [protected]

Set the popup menu for this item.

Parameters:
popuppopupmenu window to attach to this item
Returns:
Nothing.

Toggles the PopupMenu.

Returns:
true if the popup was opened. false if it was closed.
void CEGUI::MenuItem::updateInternalState ( const Vector2f mouse_pos) [protected]

Update the internal state of the widget with the mouse at the given position.

Parameters:
mouse_posPoint object describing, in screen pixel co-ordinates, the location of the mouse cursor.
Returns:
Nothing
virtual void CEGUI::MenuItem::updateSelf ( float  elapsed) [protected, virtual]

Perform actual update processing for this Window.

Parameters:
elapsedfloat value indicating the number of seconds elapsed since the last update call.
Returns:
Nothing.

Reimplemented from CEGUI::Window.


Member Data Documentation

Event fired when the menu item is clicked. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the MenuItem that was clicked.

 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends