Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

PG_PopupMenu::MenuItem Class Reference

Inheritance diagram for PG_PopupMenu::MenuItem:

Inheritance graph
[legend]
Collaboration diagram for PG_PopupMenu::MenuItem:

Collaboration graph
[legend]
List of all members.

Detailed Description

A menu item data structure.

Author:
Marek Habersack

Even though implemented as a class, MenuItem is not intended to be a new kind of widget - therefore it is derived only from PG_Rect for convenience. The idea is to have a "smart" data type (or a dumb class, if you prefer) that knows how to perform simple and specific actions on itself. The intention is to provide PG_PopupMenu with a fast mechanism for processing menu items - if MenuItem was derived from any of ParaGUI classes it would incurr unnecessary processing overhead.

Todo:
better separator code

icon drawing

Examples:

paratest.cpp.


Public Types

typedef Slot2< bool, MenuItem *,
PG_Pointer
MenuItemSlot
enum  MI_FLAGS { MIF_NONE = 0, MIF_DISABLED = 0x01, MIF_SEPARATOR = 0x02, MIF_SUBMENU = 0x04 }

Public Member Functions

 MenuItem (PG_PopupMenu *parent, char *caption, int id, MI_FLAGS flags)
 MenuItem (PG_PopupMenu *parent, char *caption, PG_PopupMenu *submenu)
 ~MenuItem ()
bool measureItem (PG_Rect *rect, bool full=false)
bool isPointInside (int x, int y)
void moveTo (int x, int y)
SDL_Surface * getNormal () const
SDL_Surface * getDisabled () const
SDL_Surface * getSelected () const
bool paintNormal (SDL_Surface *canvas, PG_Color *tcol, PG_Color *scol=NULL)
bool paintDisabled (SDL_Surface *canvas, PG_Color *tcol, PG_Color *scol=NULL)
bool paintSelected (SDL_Surface *canvas, PG_Color *tcol, PG_Color *scol=NULL)
void disable ()
void enable ()
bool isDisabled () const
bool isEnabled () const
void select ()
void unselect ()
bool isSelected () const
bool isSeparator () const
bool isSubMenu () const
bool isMute () const
int Width () const
int Height () const
int getId () const
PG_PopupMenugetSubMenu () const
const string & getCaption () const
 operator PG_Point const & () const

Public Attributes

SignalSelectMenuItem sigSelectMenuItem

Protected Attributes

unsigned myFlags
string myCaption
PG_PopupMenumyParent
PG_PopupMenumySubMenu
int myId
SDL_Surface * sNormal
SDL_Surface * sSelected
SDL_Surface * sDisabled
bool selected


Member Typedef Documentation

typedef Slot2<bool, MenuItem*, PG_Pointer> PG_PopupMenu::MenuItem::MenuItemSlot
 


Member Enumeration Documentation

enum PG_PopupMenu::MenuItem::MI_FLAGS
 

Enumeration values:
MIF_NONE 
MIF_DISABLED 
MIF_SEPARATOR 
MIF_SUBMENU 


Constructor & Destructor Documentation

PG_PopupMenu::MenuItem::MenuItem PG_PopupMenu parent,
char *  caption,
int  id,
MI_FLAGS  flags
 

PG_PopupMenu::MenuItem::MenuItem PG_PopupMenu parent,
char *  caption,
PG_PopupMenu submenu
 

PG_PopupMenu::MenuItem::~MenuItem  ) 
 


Member Function Documentation

void PG_PopupMenu::MenuItem::disable  )  [inline]
 

void PG_PopupMenu::MenuItem::enable  )  [inline]
 

const string & PG_PopupMenu::MenuItem::getCaption  )  const [inline]
 

Examples:
paratest.cpp.

SDL_Surface * PG_PopupMenu::MenuItem::getDisabled  )  const [inline]
 

int PG_PopupMenu::MenuItem::getId  )  const [inline]
 

Examples:
paratest.cpp.

SDL_Surface * PG_PopupMenu::MenuItem::getNormal  )  const [inline]
 

SDL_Surface * PG_PopupMenu::MenuItem::getSelected  )  const [inline]
 

PG_PopupMenu * PG_PopupMenu::MenuItem::getSubMenu  )  const [inline]
 

int PG_PopupMenu::MenuItem::Height  )  const [inline]
 

Reimplemented from PG_Rect.

bool PG_PopupMenu::MenuItem::isDisabled  )  const [inline]
 

bool PG_PopupMenu::MenuItem::isEnabled  )  const [inline]
 

bool PG_PopupMenu::MenuItem::isMute  )  const [inline]
 

bool PG_PopupMenu::MenuItem::isPointInside int  x,
int  y
 

bool PG_PopupMenu::MenuItem::isSelected  )  const [inline]
 

bool PG_PopupMenu::MenuItem::isSeparator  )  const [inline]
 

bool PG_PopupMenu::MenuItem::isSubMenu  )  const [inline]
 

bool PG_PopupMenu::MenuItem::measureItem PG_Rect rect,
bool  full = false
 

void PG_PopupMenu::MenuItem::moveTo int  x,
int  y
[inline]
 

PG_PopupMenu::MenuItem::operator PG_Point const &  )  const [inline]
 

bool PG_PopupMenu::MenuItem::paintDisabled SDL_Surface *  canvas,
PG_Color tcol,
PG_Color scol = NULL
 

bool PG_PopupMenu::MenuItem::paintNormal SDL_Surface *  canvas,
PG_Color tcol,
PG_Color scol = NULL
 

bool PG_PopupMenu::MenuItem::paintSelected SDL_Surface *  canvas,
PG_Color tcol,
PG_Color scol = NULL
 

void PG_PopupMenu::MenuItem::select  )  [inline]
 

void PG_PopupMenu::MenuItem::unselect  )  [inline]
 

int PG_PopupMenu::MenuItem::Width  )  const [inline]
 

Reimplemented from PG_Rect.


Member Data Documentation

string PG_PopupMenu::MenuItem::myCaption [protected]
 

unsigned PG_PopupMenu::MenuItem::myFlags [protected]
 

int PG_PopupMenu::MenuItem::myId [protected]
 

PG_PopupMenu* PG_PopupMenu::MenuItem::myParent [protected]
 

PG_PopupMenu* PG_PopupMenu::MenuItem::mySubMenu [protected]
 

SDL_Surface* PG_PopupMenu::MenuItem::sDisabled [protected]
 

bool PG_PopupMenu::MenuItem::selected [protected]
 

SignalSelectMenuItem PG_PopupMenu::MenuItem::sigSelectMenuItem
 

SDL_Surface* PG_PopupMenu::MenuItem::sNormal [protected]
 

SDL_Surface* PG_PopupMenu::MenuItem::sSelected [protected]
 



The ParaGUI Project - Alexander Pipelka