A popup menu that can be attached to a menu bar or used stand-alone. In the first case, the widget sizes itself so that only the caption is visible, the menu items remain hidden until menu is activated. In the latter case menu sizes itself to encompass all of its items unless the menu size would exceed the space between the menu origin and the edge of the screen. In such case, menu displays a "scroller" button at the bottom.
|
Public Member Functions |
| PG_PopupMenu (PG_Widget *parent, int x, int y, char *caption, char *style="PopupMenu") |
| ~PG_PopupMenu () |
PG_PopupMenu & | addSeparator () |
bool | SetMenuItemSlot (int id, MenuItem::MenuItemSlot slot, PG_Pointer clientdata=NULL) |
int | maxItemWidth () const |
void | disableItem (int dd) |
void | enableItem (int id) |
void | trackMenu (int x=-1, int y=-1) |
| Modal popup menu will be shown - i.e.
|
|
Constructs a new menu item using the provided parameters and then adds the item to this menu.
|
PG_PopupMenu & | addMenuItem (char *caption, int ID, MenuItem::MenuItemSlot, PG_Pointer data=NULL, MenuItem::MI_FLAGS flags=MenuItem::MIF_NONE) |
| Adds a menu item whose handler (if any) is set to be a stand-alone function.
|
PG_PopupMenu & | addMenuItem (char *caption, int ID, MenuItem::MI_FLAGS flags=MenuItem::MIF_NONE) |
PG_PopupMenu & | addMenuItem (char *caption, PG_PopupMenu *sub, MenuItem::MI_FLAGS flags=MenuItem::MIF_SUBMENU) |
Public Attributes |
SignalSelectMenuItem | sigSelectMenuItem |
Protected Types |
typedef list< MenuItem
* >::iterator | MII |
Protected Member Functions |
void | eventBlit (SDL_Surface *surface, const PG_Rect &src, const PG_Rect &dst) |
| overridable eventhandler to blit the widget contents to the screen
|
void | eventMouseEnter () |
| eventhandler for mouse movements.
|
void | eventMouseLeave () |
| eventhandler for mouse movements.
|
bool | eventMouseMotion (const SDL_MouseMotionEvent *motion) |
| Overridable Eventhandler for a SDL_MouseMotionEvent message.
|
bool | eventMouseButtonDown (const SDL_MouseButtonEvent *button) |
| Overridable Eventhandler for a SDL_MouseButtonEvent message.
|
bool | eventMouseButtonUp (const SDL_MouseButtonEvent *button) |
| Overridable Eventhandler for a SDL_MouseButtonEvent message.
|
bool | eventKeyDown (const SDL_KeyboardEvent *key) |
| Overridable Eventhandler for a SDL_KeyboardEvent message.
|
void | eventMoveWidget (int x, int y) |
| Callback for the MoveWidget event.
|
void | eventShow () |
| overridable eventhandler called whenever the widget gets shown.
|
void | eventHide () |
| overridable eventhandler called whenever the widget gets hidden.
|
void | LoadThemeStyle (const char *widgettype) |
| Load a specific themestyle.
|
void | LoadThemeStyle (const char *widgettype, const char *objectname) |
| Load a style from the theme definition.
|
virtual bool | getCaptionHeight (PG_Rect &rect, bool constructing=false) |
virtual void | recalcRect () |
virtual void | handleClick (int x, int y) |
virtual void | enslave (PG_PopupMenu *master) |
virtual void | liberate () |
Protected Attributes |
list< MenuItem * > | items |
string | myCaption |
| the menu items collection
|
PG_Color | captionActiveColor |
| menu caption
|
PG_Color | captionInactiveColor |
PG_Color | miNormalColor |
PG_Color | miSelectedColor |
PG_Color | miDisabledColor |
PG_Color | sepNormalColor |
PG_Color | sepShadowColor |
int | xPadding |
int | yPadding |