DD::Image::Menu Class Reference

List of all members.

Public Types

enum  Style { NO_STYLE, ITALIC, OBLIQUE }

Public Member Functions

void add (const char *text, int shortcut, int event)
void add_divider ()
void set_default (int event)
void enable (int event)
void disable (int event)
void hide (int event)
void show (int event)
void set_data (int event, MenuItemData *data)
const MenuItemData * get_data (int event)
void set_style (int event, enum Style style)

Public Attributes

int deflt
void * implementation

Detailed Description

Describes a pop-up menu. Currently this can only be used in a ViewerContext::menu() call to make it pop up and select an item, which then modifies the ViewerContext::event().


Member Function Documentation

void Menu::add ( const char *  text,
int  shortcut,
int  event 
)

Add a new item to the menu. The text may contain '/' characters to indicate a submenu hierarchy. The shortcut is an 'or' of ViewerContext::state() bit flags and ViewerContext::key() values to indicate what shift keys need to be held down and what key is a shortcut. Use 0 for no shortcut. The event is an integer that is passed to a Knob handle callback if the user picks an item off the menu.

void Menu::add_divider ( )

Add a horizontal dividing line to the menu.

void DD::Image::Menu::set_default ( int  event) [inline]

The item returning event is made the default. When the user pops up the menu the cursor will be pointing at this item. Calling ViewerContext::clear_is_click() will make a mouse click pick that item rather than just popping up the menu and waiting for another click.

void Menu::enable ( int  event)

The item returning event is enabled so the user can pick it.

void Menu::disable ( int  event)

The item returning event is disabled so the user cannot pick it and it is grayed out.

void Menu::hide ( int  event)

The item returning event is disabled so the user cannot pick it and is made completely invisible, as though it was not there. To get it back call enable() or disable().

void Menu::show ( int  event)

Same as enable()

void Menu::set_data ( int  event,
MenuItemData *  data 
)

The item returning event has the given opaque pointer set to some additional data.

const MenuItemData * Menu::get_data ( int  event)

The item returning event might have opaque data, this is returned. If no data was assigned using set_data(), it will return NULL.

void Menu::set_style ( int  event,
enum Style  style 
)

The item returning event can have a style, for instance you might want the item to appear oblique or italic. This sets the given item to that style.