wGui::CMenuBase Class Reference

The menu base class. More...

#include <wg_menu.h>

Inheritance diagram for wGui::CMenuBase:

wGui::CWindow wGui::CMessageClient wGui::CMenu wGui::CPopupMenu

Public Member Functions

Protected Types

Protected Member Functions

Protected Attributes

Data Structures


Detailed Description

The menu base class.

The CMenuBase is the base class for CMenus and CPopupMenus, and shouldn't be instantiated itself Menus will generate CTRL_SINGLELCLICK messages when a menu item is selected

Definition at line 70 of file wg_menu.h.


Constructor & Destructor Documentation

wGui::CMenuBase::CMenuBase ( const CRect WindowRect,
CWindow pParent,
CFontEngine pFontEngine = 0 
)

Constructs a new MenuBase

Parameters:
WindowRect A CRect that defines the outer limits of the control
pParent A pointer to the parent window
pFontEngine A pointer to the font engine to use when drawing the control If this is left out (or set to 0) it will use the default font engine specified by the CApplication (which must be set before instantiating this object)

Definition at line 40 of file wg_menu.cpp.

References wGui::CMessage::CTRL_SINGLELCLICK, wGui::CMessage::CTRL_TIMER, wGui::CApplication::GetDefaultFontEngine(), wGui::CApplication::GetDefaultSelectionColor(), wGui::CMessageServer::Instance(), wGui::CApplication::Instance(), m_HighlightColor, m_pFontEngine, m_pPopupTimer, wGui::CMessage::MOUSE_MOVE, and wGui::CMessageServer::RegisterMessageClient().


Member Function Documentation

void wGui::CMenuBase::InsertMenuItem ( const SMenuItem MenuItem,
int  iPosition = -1 
) [virtual]

Insert a menu item into the menu

Parameters:
MenuItem An SMenuItem struct that defines the menu item to add
iPosition The position to insert it at, -1 will insert it at the end, defaults to -1

Reimplemented in wGui::CMenu.

Definition at line 75 of file wg_menu.cpp.

References m_bCachedRectsValid, m_MenuItems, m_pFontEngine, wGui::SMenuItem::sItemText, and wGui::CRenderedString::VALIGN_TOP.

void wGui::CMenuBase::RemoveMenuItem ( int  iPosition  ) 

Removes a menu item or a submenu

Parameters:
iPosition The item to be removed

Definition at line 84 of file wg_menu.cpp.

References Draw(), m_bCachedRectsValid, and m_MenuItems.

int wGui::CMenuBase::GetMenuItemCount ( void   )  const [inline]

Gets the number of items in a menu

Returns:
The number of items in the menu

Definition at line 94 of file wg_menu.h.

References m_MenuItems.

void wGui::CMenuBase::SetHighlightColor ( const CRGBColor HighlightColor  )  [inline]

Set the highlight color for the menu

Parameters:
HighlightColor The new color to use for highlighting

Definition at line 101 of file wg_menu.h.

References m_HighlightColor.

virtual void wGui::CMenuBase::Draw ( void   )  const [pure virtual]

CWindow overrides Draws the menu

Reimplemented from wGui::CWindow.

Implemented in wGui::CMenu, and wGui::CPopupMenu.

Referenced by HandleMessage(), and RemoveMenuItem().

bool wGui::CMenuBase::OnMouseButtonDown ( CPoint  Point,
unsigned int  Button 
) [virtual]

This is called whenever the menu is clicked on by the mouse Only the topmost window that bounds the point will be called by the system

Parameters:
Point The point where the mouse clicked
Button A bitfield indicating which button the window was clicked with
Returns:
True if it's in the bounds of the menu

Reimplemented from wGui::CWindow.

Reimplemented in wGui::CMenu, and wGui::CPopupMenu.

Definition at line 102 of file wg_menu.cpp.

References wGui::CWindow::m_bVisible, and wGui::CWindow::m_ChildWindows.

Referenced by wGui::CPopupMenu::OnMouseButtonDown(), and wGui::CMenu::OnMouseButtonDown().

bool wGui::CMenuBase::HandleMessage ( CMessage pMessage  )  [virtual]

CMenus handle MOUSE_BUTTONDOWN and MOUSE_BUTTONUP messages

Parameters:
pMessage A pointer to the message

Reimplemented from wGui::CWindow.

Reimplemented in wGui::CMenu, and wGui::CPopupMenu.

Definition at line 123 of file wg_menu.cpp.

References wGui::CMessage::CTRL_SINGLELCLICK, wGui::CMessage::CTRL_TIMER, wGui::CMessage::Destination(), Draw(), wGui::CWindow::HandleMessage(), wGui::CRect::HitTest(), wGui::CMessageServer::Instance(), wGui::CWindow::m_bVisible, m_MenuItems, m_pHighlightedItem, wGui::CWindow::m_pParentWindow, m_pPopupTimer, wGui::CWindow::m_WindowRect, wGui::CMessage::MessageType(), wGui::CMessage::MOUSE_MOVE, wGui::SMenuItem::pPopup, wGui::CMessageServer::QueueMessage(), wGui::CRect::RELPOS_INSIDE, wGui::CRect::SizeRect(), wGui::CMessage::Source(), wGui::CTimer::StartTimer(), wGui::CTimer::StopTimer(), UpdateCachedRects(), wGui::CValueMessage< T >::Value(), and wGui::CWindow::ViewToWindow().

Referenced by wGui::CPopupMenu::HandleMessage(), and wGui::CMenu::HandleMessage().

virtual void wGui::CMenuBase::ShowActivePopup ( const CRect ParentRect,
const CRect BoundingRect 
) [protected, pure virtual]

Check to see where it will fit, then show the popup menu

Parameters:
ParentRect A CRect that defines the dimensions of the item that is spawning the popup
BoundingRect A CRect that defines the boundaries the popup has to fit in

Implemented in wGui::CMenu, and wGui::CPopupMenu.


Field Documentation

CFontEngine* wGui::CMenuBase::m_pFontEngine [protected]

A pointer to the font engine to use to render the text

Definition at line 132 of file wg_menu.h.

Referenced by CMenuBase(), wGui::CMenu::InsertMenuItem(), and InsertMenuItem().


The documentation for this class was generated from the following files:
Generated on Wed May 16 23:11:27 2007 for wGui by  doxygen 1.5.1