# CEGUI::MenuBase Class Reference

Abstract base class for menus. More...

Inheritance diagram for CEGUI::MenuBase:

[legend]
Collaboration diagram for CEGUI::MenuBase:

[legend]
List of all members.

## Public Member Functions

float | getItemSpacing (void) const
| Get the item spacing for this menu.
float | getHorzPadding (void) const
| Get the horizontal padding for this menu's items.
float | getVertPadding (void) const
| Get the vertical padding for this menu's items.
float | getBorderWidth (void) const
| Get the border width for this menu.
const ColourRect & | getBackgroundColours (void) const
| Get the ColourRect with the colours used for rendering the background of this menu.
bool | isMultiplePopupsAllowed (void) const
| Return whether this menu allows multiple popup menus to open at the same time.
MenuItem * | getPopupMenuItem (void) const
| Get currently opened MenuItem in this menu. Returns NULL if menu item is open.
void | setItemSpacing (float spacing)
| Set the item spacing for this menu.
void | setHorzPadding (float padding)
| Set the horizontal padding for this menu's items.
void | setVertPadding (float padding)
| Set the vertical padding for this menu's items.
void | setBorderWidth (float border)
| Set the border width for this menu.
void | setBackgroundColours (const ColourRect &cr)
| Set the background colours to used when rendereing this menu.
void | changePopupMenuItem (MenuItem *item)
| Change the currently open MenuItem in this menu.
void | setAllowMultiplePopups (bool setting)
| Set whether this menu allows multiple popup menus to opened simultaneously.
| MenuBase (const String &type, const String &name)
| Constructor for MenuBase objects.
virtual | ~MenuBase (void)
| Destructor for MenuBase objects.

## Static Public Attributes

static const String | EventNamespace
| Namespace for global events.
static const colour | DefaultBackgroundColour = 0xFFFFFFFF
| Default background colour.
static const String | EventPopupOpened
| A MenuItem attached to this menu opened a PopupMenu.
static const String | EventPopupClosed
| A MenuItem attached to this menu opened a PopupMenu.

## Protected Member Functions

virtual void | onPopupOpened (WindowEventArgs &e)
| handler invoked internally when the a MenuItem attached to this menu opens its popup.
virtual void | onPopupClosed (WindowEventArgs &e)
| handler invoked internally when the a MenuItem attached to this menu closes its popup.
void | addMenuBaseEvents (void)
| Add MenuBase specific events.
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 heirarchy.

## Protected Attributes

float | d_itemSpacing
| The spacing in pixels between items.
float | d_horzPadding
| The width in pixels that is added to the left and right of each item.
float | d_vertPadding
| The height in pixels that is added to the top and bottom of each item.
float | d_borderWidth
| The width in pixels of the border around the entire content of this menu.
ColourRect | d_backgroundColours
| The colours used when rendering the background of this menu.
MenuItem * | d_popup
| The currently open MenuItem. NULL if no item is open. If multiple popups are allowed, this means nothing.
bool | d_allowMultiplePopups
| true if multiple popup menus are allowed smultaneously. false if not.

## Detailed Description

Abstract base class for menus.

## Member Function Documentation

void CEGUI::MenuBase::changePopupMenuItem | ( | MenuItem * | item | ) |

Change the currently open MenuItem in this menu.

Parameters:

  | item | Pointer to a MenuItem to open or NULL to close any opened.

const ColourRect& CEGUI::MenuBase::getBackgroundColours | ( | void |  | ) | const`[inline]`

Get the ColourRect with the colours used for rendering the background of this menu.

Returns:
  A ColourRect with the colours used for rendering the background of this menu.

float CEGUI::MenuBase::getBorderWidth | ( | void |  | ) | const`[inline]`

Get the border width for this menu.

Returns:
  A float value with the current border width for this menu.

float CEGUI::MenuBase::getHorzPadding | ( | void |  | ) | const`[inline]`

Get the horizontal padding for this menu's items.

Returns:
  A float value with the current horizontal padding for this menu's items.

float CEGUI::MenuBase::getItemSpacing | ( | void |  | ) | const`[inline]`

Get the item spacing for this menu.

Returns:
  A float value with the current item spacing for this menu

MenuItem* CEGUI::MenuBase::getPopupMenuItem | ( | void |  | ) | const`[inline]`

Get currently opened MenuItem in this menu. Returns NULL if menu item is open.

Returns:
  Pointer to the MenuItem currently open.

float CEGUI::MenuBase::getVertPadding | ( | void |  | ) | const`[inline]`

Get the vertical padding for this menu's items.

Returns:
  A float value with the current vertical padding for this menu's items.

bool CEGUI::MenuBase::isMultiplePopupsAllowed | ( | void |  | ) | const`[inline]`

Return whether this menu allows multiple popup menus to open at the same time.

Returns:
  true if this menu allows multiple popup menus to be opened simultaneously. false if not

virtual bool CEGUI::MenuBase::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 heirarchy.

Parameters:

  | class_name | The class name that is to be checked.

Returns:
  true if this window was inherited from class_name. false if not.

Reimplemented from CEGUI::ItemListBase.

Reimplemented in CEGUI::Menubar, and CEGUI::PopupMenu.