#include <wg_menu.h>
Inheritance diagram for wGui::CMenu:
Definition at line 165 of file wg_menu.h.
wGui::CMenu::CMenu | ( | const CRect & | WindowRect, | |
CWindow * | pParent, | |||
CFontEngine * | pFontEngine = 0 | |||
) |
Constructs a new Menu
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 205 of file wg_menu.cpp.
References Draw(), wGui::CMessageServer::Instance(), wGui::CMessage::MOUSE_MOVE, and wGui::CMessageServer::RegisterMessageClient().
void wGui::CMenu::InsertMenuItem | ( | const SMenuItem & | MenuItem, | |
int | iPosition = -1 | |||
) | [virtual] |
Insert a menu item into the menu
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 from wGui::CMenuBase.
Definition at line 219 of file wg_menu.cpp.
References Draw(), wGui::CMenuBase::m_bCachedRectsValid, wGui::CMenuBase::m_MenuItems, wGui::CMenuBase::m_pFontEngine, wGui::SMenuItem::pPopup, wGui::CPopupMenu::SetParentMenu(), wGui::SMenuItem::sItemText, and wGui::CRenderedString::VALIGN_NORMAL.
void wGui::CMenu::Draw | ( | void | ) | const [virtual] |
CWindow overrides Draws the menu
Implements wGui::CMenuBase.
Definition at line 232 of file wg_menu.cpp.
References wGui::CRect::Bottom(), wGui::COLOR_DARKGRAY, wGui::COLOR_LIGHTGRAY, wGui::CWindow::Draw(), wGui::CPainter::DrawRect(), wGui::CPainter::DrawVLine(), wGui::CRect::Grow(), wGui::CRect::Left(), wGui::CMenuBase::m_HighlightColor, wGui::CMenuBase::m_MenuItems, wGui::CMenuBase::m_pHighlightedItem, wGui::CWindow::m_pSDLSurface, wGui::CPainter::PAINT_REPLACE, wGui::CRect::Right(), wGui::CRect::Top(), and UpdateCachedRects().
Referenced by CMenu(), HandleMessage(), and InsertMenuItem().
bool wGui::CMenu::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
Point | The point where the mouse clicked | |
Button | A bitfield indicating which button the window was clicked with |
Reimplemented from wGui::CMenuBase.
Definition at line 260 of file wg_menu.cpp.
References wGui::CMessage::CTRL_SINGLELCLICK, wGui::CWindow::GetAncestor(), wGui::CWindow::GetClientRect(), wGui::CMenuBase::HideActivePopup(), wGui::CRect::HitTest(), wGui::CMessageServer::Instance(), wGui::CMouseMessage::LEFT, wGui::CWindow::m_bVisible, wGui::CMenuBase::m_MenuItems, wGui::CMenuBase::m_pActivePopup, wGui::CWindow::m_pParentWindow, wGui::CWindow::m_WindowRect, wGui::CMenuBase::OnMouseButtonDown(), wGui::CMessageServer::QueueMessage(), wGui::CRect::RELPOS_INSIDE, wGui::CWindow::ROOT, ShowActivePopup(), wGui::CRect::SizeRect(), UpdateCachedRects(), and wGui::CWindow::ViewToWindow().
bool wGui::CMenu::HandleMessage | ( | CMessage * | pMessage | ) | [virtual] |
CMenus handle MOUSE_BUTTONDOWN and MOUSE_BUTTONUP messages
pMessage | A pointer to the message |
Reimplemented from wGui::CMenuBase.
Definition at line 296 of file wg_menu.cpp.
References Draw(), wGui::CMenuBase::HandleMessage(), wGui::CRect::HitTest(), wGui::CWindow::m_bVisible, wGui::CMenuBase::m_MenuItems, wGui::CMenuBase::m_pHighlightedItem, wGui::CWindow::m_WindowRect, wGui::CMessage::MessageType(), wGui::CMessage::MOUSE_MOVE, wGui::CRect::RELPOS_INSIDE, wGui::CRect::SizeRect(), UpdateCachedRects(), and wGui::CWindow::ViewToWindow().
void wGui::CMenu::ShowActivePopup | ( | const CRect & | ParentRect, | |
const CRect & | BoundingRect | |||
) | [protected, virtual] |
Check to see where it will fit, then show the popup menu
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 |
Implements wGui::CMenuBase.
Definition at line 375 of file wg_menu.cpp.
References wGui::CRect::BottomLeft(), wGui::CWindow::GetAncestor(), wGui::CWindow::GetWindowRect(), wGui::CRect::HitTest(), wGui::CRect::Left(), wGui::CMenuBase::m_pActivePopup, wGui::CWindow::PARENT, wGui::CRect::RELPOS_LEFT, wGui::CRect::RELPOS_RIGHT, wGui::CRect::Right(), wGui::CWindow::SetNewParent(), wGui::CPopupMenu::Show(), and wGui::CRect::Width().
Referenced by OnMouseButtonDown().