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. | |
PopupMenu * | getPopupMenu (void) const |
Get the PopupMenu that is currently attached to this MenuItem. | |
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. | |
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 |
The menu item was clicked. | |
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 has left this window's area. | |
virtual void | onTextChanged (WindowEventArgs &e) |
Handler called when the window's text is changed. | |
void | updateInternalState (const Point &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. | |
virtual bool | testClassName_impl (const String &class_name) const |
Return whether this window was inherited from the given class name at some point in the inheritance hierarchy. | |
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. | |
PopupMenu * | d_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. |
void CEGUI::MenuItem::closeAllMenuItemPopups | ( | ) | [protected] |
Recursive function that closes all popups down the hierarcy starting with this one.
References closeAllMenuItemPopups(), CEGUI::PopupMenu::closePopupMenu(), closePopupMenu(), CEGUI::ItemEntry::d_ownerList, CEGUI::Window::getParent(), and CEGUI::Window::testClassName().
Referenced by closeAllMenuItemPopups(), and onClicked().
void CEGUI::MenuItem::closePopupMenu | ( | bool | notify = true |
) |
Closes the PopupMenu.
notify | true if the parent menubar (if any) is to handle the close. |
References CEGUI::MenuBase::changePopupMenuItem(), CEGUI::PopupMenu::closePopupMenu(), d_opened, CEGUI::ItemEntry::d_ownerList, d_popup, CEGUI::MenuBase::isMultiplePopupsAllowed(), CEGUI::Window::requestRedraw(), and CEGUI::Window::testClassName().
Referenced by CEGUI::MenuBase::changePopupMenuItem(), closeAllMenuItemPopups(), and togglePopupMenu().
PopupMenu* CEGUI::MenuItem::getPopupMenu | ( | void | ) | const [inline] |
Get the PopupMenu that is currently attached to this MenuItem.
Referenced by CEGUI::MenuBase::changePopupMenuItem(), CEGUI::FalagardMenuItem::getItemPixelSize(), and CEGUI::FalagardMenuItem::render().
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)
Referenced by CEGUI::FalagardMenuItem::render().
bool CEGUI::MenuItem::isPushed | ( | void | ) | const [inline] |
Return true if the button widget is in the pushed state.
Referenced by CEGUI::FalagardMenuItem::render().
void CEGUI::MenuItem::onCaptureLost | ( | WindowEventArgs & | e | ) | [protected, virtual] |
Handler called when this window loses capture of mouse inputs.
e | WindowEventArgs 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.
References d_pushed, CEGUI::Window::getPosition(), CEGUI::MouseCursor::getSingleton(), CEGUI::EventArgs::handled, CEGUI::Window::requestRedraw(), and updateInternalState().
void CEGUI::MenuItem::onMouseButtonDown | ( | MouseEventArgs & | e | ) | [protected, virtual] |
Handler called when a mouse button has been depressed within this window's area.
e | MouseEventArgs object. All fields are valid. |
Reimplemented from CEGUI::Window.
References CEGUI::MouseEventArgs::button, CEGUI::Window::captureInput(), d_popupWasClosed, d_pushed, CEGUI::EventArgs::handled, CEGUI::LeftButton, CEGUI::MouseEventArgs::position, CEGUI::Window::requestRedraw(), togglePopupMenu(), and updateInternalState().
void CEGUI::MenuItem::onMouseButtonUp | ( | MouseEventArgs & | e | ) | [protected, virtual] |
Handler called when a mouse button has been released within this window's area.
e | MouseEventArgs object. All fields are valid. |
Reimplemented from CEGUI::Window.
References CEGUI::MouseEventArgs::button, d_popupWasClosed, CEGUI::System::getSingleton(), CEGUI::Window::getTargetChildAtPosition(), CEGUI::EventArgs::handled, CEGUI::LeftButton, onClicked(), CEGUI::MouseEventArgs::position, and CEGUI::Window::releaseInput().
void CEGUI::MenuItem::onMouseLeaves | ( | MouseEventArgs & | e | ) | [protected, virtual] |
Handler called when the mouse cursor has left this window's area.
e | MouseEventArgs object. All fields are valid. |
Reimplemented from CEGUI::Window.
References d_hovering, CEGUI::EventArgs::handled, and CEGUI::Window::requestRedraw().
void CEGUI::MenuItem::onMouseMove | ( | MouseEventArgs & | e | ) | [protected, virtual] |
Handler called when the mouse cursor has been moved within this window's area.
e | MouseEventArgs object. All fields are valid. |
Reimplemented from CEGUI::Window.
References CEGUI::EventArgs::handled, CEGUI::MouseEventArgs::position, and updateInternalState().
void CEGUI::MenuItem::onTextChanged | ( | WindowEventArgs & | e | ) | [protected, virtual] |
Handler called when the window's text is changed.
e | WindowEventArgs 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.
References CEGUI::Window::getParent(), CEGUI::EventArgs::handled, and CEGUI::Window::testClassName().
void CEGUI::MenuItem::openPopupMenu | ( | bool | notify = true |
) |
Opens the PopupMenu.
notify | true if the parent menu bar or menu popup (if any) is to handle the open. |
References CEGUI::Size::d_height, d_opened, CEGUI::ItemEntry::d_ownerList, CEGUI::Window::d_pixelSize, d_popup, CEGUI::Size::d_width, CEGUI::PopupMenu::openPopupMenu(), CEGUI::Window::requestRedraw(), CEGUI::Window::setPosition(), and CEGUI::Window::testClassName().
Referenced by CEGUI::MenuBase::changePopupMenuItem(), togglePopupMenu(), and updateInternalState().
void CEGUI::MenuItem::setPopupMenu | ( | PopupMenu * | popup | ) |
Set the popup menu for this item.
popup | popupmenu window to attach to this item |
References setPopupMenu_impl().
void CEGUI::MenuItem::setPopupMenu_impl | ( | PopupMenu * | popup, | |
bool | add_as_child = true | |||
) | [protected] |
Set the popup menu for this item.
popup | popupmenu window to attach to this item |
References CEGUI::Window::addChildWindow(), d_opened, d_popup, CEGUI::Window::isDestroyedByParent(), CEGUI::Window::removeChildWindow(), and CEGUI::Window::requestRedraw().
Referenced by setPopupMenu().
virtual bool CEGUI::MenuItem::testClassName_impl | ( | const String & | class_name | ) | const [inline, protected, virtual] |
Return whether this window was inherited from the given class name at some point in the inheritance hierarchy.
class_name | The class name that is to be checked. |
Reimplemented from CEGUI::ItemEntry.
References CEGUI::ItemEntry::testClassName_impl().
bool CEGUI::MenuItem::togglePopupMenu | ( | void | ) |
Toggles the PopupMenu.
References closePopupMenu(), d_opened, and openPopupMenu().
Referenced by onMouseButtonDown().
void CEGUI::MenuItem::updateInternalState | ( | const Point & | mouse_pos | ) | [protected] |
Update the internal state of the widget with the mouse at the given position.
mouse_pos | Point object describing, in screen pixel co-ordinates, the location of the mouse cursor. |
References d_hovering, CEGUI::ItemEntry::d_ownerList, CEGUI::Window::getCaptureWindow(), CEGUI::MenuBase::getPopupMenuItem(), CEGUI::System::getSingletonPtr(), CEGUI::System::getWindowContainingMouse(), CEGUI::Window::isHit(), CEGUI::MenuBase::isMultiplePopupsAllowed(), openPopupMenu(), CEGUI::Window::requestRedraw(), and CEGUI::Window::testClassName().
Referenced by onCaptureLost(), onMouseButtonDown(), and onMouseMove().