GG::MenuItem Struct Reference

serves as a single menu entry in a GG::MenuBar or GG::PopupMenu; may include a submenu. More...

#include <Menu.h>

List of all members.

Signal Types

typedef boost::signal< void(int)> SelectedIDSignalType
typedef boost::signal< void()> SelectedSignalType

Slot Types

typedef SelectedIDSignalType::slot_type SelectedIDSlotType
typedef SelectedSignalType::slot_type SelectedSlotType

Accessors

boost::shared_ptr< SelectedIDSignalTypeSelectedIDSignal
boost::shared_ptr< SelectedSignalTypeSelectedSignal

Structors

 MenuItem ()
 MenuItem (const std::string &str, int id, bool disable, bool check)
 MenuItem (const std::string &str, int id, bool disable, bool check, const SelectedIDSlotType &slot)
 MenuItem (const std::string &str, int id, bool disable, bool check, const SelectedSlotType &slot)
template<class T1, class T2>
 MenuItem (const std::string &str, int id, bool disable, bool check, void(T1::*slot)(int), T2 *obj)
template<class T1, class T2>
 MenuItem (const std::string &str, int id, bool disable, bool check, void(T1::*slot)(), T2 *obj)
virtual ~MenuItem ()

Public Attributes

std::string label
int item_ID
bool disabled
bool checked
std::vector< MenuItemnext_level


Detailed Description

serves as a single menu entry in a GG::MenuBar or GG::PopupMenu; may include a submenu.

All legal item_IDs are positive (and so non-zero); any item_ID <= 0 is considered invalid. Each MenuItem has a signal that is emmitted with its menu_ID member whenever it is selected. Such signals may be emitted even when the menu_ID is 0. These signals allow each MenuItem to be attached directly to code that should be executed when that item is selected. Note that the signal is not serialized. The user must restore it after the MenuItem is reloaded.

Definition at line 46 of file Menu.h.


Member Typedef Documentation

typedef boost::signal<void (int)> GG::MenuItem::SelectedIDSignalType

invokes the appropriate functor to handle the menu selection, and passes the ID assigned to the item

Definition at line 49 of file Menu.h.

typedef boost::signal<void ()> GG::MenuItem::SelectedSignalType

invokes the appropriate functor to handle the menu selection

Definition at line 50 of file Menu.h.

typedef SelectedIDSignalType::slot_type GG::MenuItem::SelectedIDSlotType

type of functor(s) invoked on a SelectedSignalType

Definition at line 54 of file Menu.h.

typedef SelectedSignalType::slot_type GG::MenuItem::SelectedSlotType

type of functor(s) invoked on a SelectedSignalType

Definition at line 55 of file Menu.h.


Constructor & Destructor Documentation

GG::MenuItem::MenuItem (  ) 

default ctor

GG::MenuItem::MenuItem ( const std::string &  str,
int  id,
bool  disable,
bool  check 
)

ctor

GG::MenuItem::MenuItem ( const std::string &  str,
int  id,
bool  disable,
bool  check,
const SelectedIDSlotType slot 
)

ctor that allows direct attachment of this item's signal to a "slot" function or functor

GG::MenuItem::MenuItem ( const std::string &  str,
int  id,
bool  disable,
bool  check,
const SelectedSlotType slot 
)

ctor that allows direct attachment of this item's signal to a "slot" function or functor

template<class T1, class T2>
GG::MenuItem::MenuItem ( const std::string &  str,
int  id,
bool  disable,
bool  check,
void(T1::*)(int)  slot,
T2 *  obj 
) [inline]

ctor that allows direct attachment of this item's signal to a "slot" member function of a specific object

Definition at line 302 of file Menu.h.

References SelectedIDSignal.

template<class T1, class T2>
GG::MenuItem::MenuItem ( const std::string &  str,
int  id,
bool  disable,
bool  check,
void(T1::*)()  slot,
T2 *  obj 
) [inline]

ctor that allows direct attachment of this item's signal to a "slot" member function of a specific object

Definition at line 314 of file Menu.h.

References SelectedSignal.

virtual GG::MenuItem::~MenuItem (  )  [virtual]

virtual dtor


Member Data Documentation

boost::shared_ptr<SelectedIDSignalType> GG::MenuItem::SelectedIDSignal [mutable]

the selected signal object for this MenuItem that conveys the selected menu item ID

Definition at line 80 of file Menu.h.

Referenced by MenuItem().

boost::shared_ptr<SelectedSignalType> GG::MenuItem::SelectedSignal [mutable]

the selected signal object for this MenuItem

Definition at line 81 of file Menu.h.

Referenced by MenuItem().

std::string GG::MenuItem::label

text shown for this menu item

Definition at line 84 of file Menu.h.

int GG::MenuItem::item_ID

ID number associated with this menu item.

Definition at line 85 of file Menu.h.

bool GG::MenuItem::disabled

set to true when this menu item is disabled

Definition at line 86 of file Menu.h.

bool GG::MenuItem::checked

set to true when this menu item can be toggled, and is currently on

Definition at line 87 of file Menu.h.

std::vector<MenuItem> GG::MenuItem::next_level

submenu off of this menu item; may be emtpy

Definition at line 88 of file Menu.h.


The documentation for this struct was generated from the following file:
Generated on Wed Mar 26 14:35:42 2008 for GG by  doxygen 1.5.2