#include <wg_menu.h>
Inheritance diagram for wGui::CPopupMenu:
Definition at line 219 of file wg_menu.h.
wGui::CPopupMenu::CPopupMenu | ( | const CRect & | WindowRect, | |
CWindow * | pParent, | |||
CFontEngine * | pFontEngine = 0 | |||
) |
Constructs a new Popup 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 402 of file wg_menu.cpp.
References Draw(), wGui::CMessageServer::Instance(), wGui::CWindow::m_bVisible, wGui::CMessage::MOUSE_BUTTONDOWN, and wGui::CMessageServer::RegisterMessageClient().
void wGui::CPopupMenu::Show | ( | CPoint | Position | ) |
Show the popup at the given point
Position | The point to use for the top left corner of the popup, in view coordinates |
Definition at line 418 of file wg_menu.cpp.
References wGui::CRect::Bottom(), Draw(), wGui::CWindow::GetAncestor(), wGui::CWindow::GetView(), wGui::CWindow::GetWindowRect(), wGui::CRect::Height(), Hide(), wGui::CWindow::m_bVisible, wGui::CMenuBase::m_MenuItems, wGui::CWindow::m_pParentWindow, wGui::CWindow::m_WindowRect, wGui::CWindow::PARENT, wGui::CWindow::ROOT, wGui::CView::SetFloatingWindow(), wGui::CWindow::SetWindowRect(), wGui::CPoint::SetX(), wGui::CPoint::SetY(), wGui::CWindow::ViewToClient(), wGui::CRect::Width(), wGui::CPoint::XPos(), and wGui::CPoint::YPos().
Referenced by ShowActivePopup(), and wGui::CMenu::ShowActivePopup().
void wGui::CPopupMenu::HideAll | ( | void | ) |
Hide the popup, along with it's popup parents and children This method just searches for the root popup, and then calls Hide() on it
Definition at line 488 of file wg_menu.cpp.
References Hide(), wGui::CMenuBase::HideActivePopup(), HideAll(), and wGui::CWindow::m_pParentWindow.
Referenced by HandleMessage(), HideAll(), and OnMouseButtonDown().
bool wGui::CPopupMenu::IsRootPopup | ( | void | ) | [inline] |
Indicates if the popup menu has any popup parents
Definition at line 248 of file wg_menu.h.
References wGui::CWindow::m_pParentWindow.
void wGui::CPopupMenu::SetParentMenu | ( | CMenu * | pParentMenu | ) | [inline] |
This is only for root popup menus that are dropped by a CMenu This doesn't set the actual parent of the control since the root window (probably a CView) should be the real parent This is called automatically when a popup menu is inserted into a CMenu (via InsertMenuItem)
pParentMenu | A pointer to the CMenu object that acts as the Popup's parent |
Definition at line 254 of file wg_menu.h.
References m_pParentMenu.
Referenced by wGui::CMenu::InsertMenuItem().
void wGui::CPopupMenu::Draw | ( | void | ) | const [virtual] |
CWindow overrides Draws the menu
Implements wGui::CMenuBase.
Definition at line 524 of file wg_menu.cpp.
References wGui::CBitmapResourceHandle::Bitmap(), wGui::CRect::Bottom(), wGui::COLOR_DARKGRAY, wGui::COLOR_LIGHTGRAY, wGui::CWindow::Draw(), wGui::CPainter::DrawHLine(), wGui::CPainter::DrawRect(), wGui::CPainter::DrawVLine(), wGui::CRect::Grow(), wGui::CRect::Height(), wGui::CRect::Left(), wGui::CMenuBase::m_HighlightColor, wGui::CMenuBase::m_hRightArrowBitmap, wGui::CMenuBase::m_MenuItems, wGui::CMenuBase::m_pHighlightedItem, wGui::CWindow::m_pSDLSurface, wGui::CWindow::m_WindowRect, wGui::CPainter::PAINT_REPLACE, wGui::CRect::Right(), wGui::CRect::SetLeft(), wGui::CRect::SizeRect(), wGui::CRect::Top(), wGui::CRect::TopLeft(), UpdateCachedRects(), and wGui::CRect::Width().
Referenced by CPopupMenu(), Hide(), and Show().
void wGui::CPopupMenu::PaintToSurface | ( | SDL_Surface & | ScreenSurface, | |
SDL_Surface & | FloatingSurface, | |||
const CPoint & | Offset | |||
) | const [virtual] |
Blit the window to the given surface, using m_WindowRect as the offset into the surface
ScreenSurface | A reference to the surface that the window will be copied to | |
FloatingSurface | A reference to the floating surface which is overlayed at the very end (used for tooltips, menus and such) | |
Offset | This is the current offset into the Surface that should be used as reference |
Reimplemented from wGui::CWindow.
Definition at line 573 of file wg_menu.cpp.
References wGui::CWindow::m_bVisible, wGui::CWindow::m_ChildWindows, wGui::CWindow::m_ClientRect, wGui::CWindow::m_pSDLSurface, wGui::CWindow::m_WindowRect, wGui::CRect::SizeRect(), and wGui::CRect::TopLeft().
bool wGui::CPopupMenu::OnMouseButtonDown | ( | CPoint | Point, | |
unsigned int | Button | |||
) | [virtual] |
This is called whenever the popup 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 589 of file wg_menu.cpp.
References wGui::CMessage::CTRL_SINGLELCLICK, wGui::CWindow::GetAncestor(), wGui::CWindow::GetClientRect(), wGui::CMenuBase::HideActivePopup(), HideAll(), wGui::CRect::HitTest(), wGui::CMessageServer::Instance(), wGui::CWindow::m_bVisible, wGui::CMenuBase::m_MenuItems, wGui::CMenuBase::m_pActivePopup, m_pParentMenu, 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::CPopupMenu::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 627 of file wg_menu.cpp.
References wGui::CMessage::CTRL_TIMER, wGui::CMessage::Destination(), wGui::CWindow::GetAncestor(), wGui::CWindow::GetClientRect(), wGui::CWindow::GetWindowRect(), wGui::CMenuBase::HandleMessage(), wGui::CMenuBase::HideActivePopup(), HideAll(), wGui::CRect::HitTest(), IsInsideChild(), wGui::CWindow::m_bVisible, wGui::CMenuBase::m_MenuItems, wGui::CMenuBase::m_pActivePopup, wGui::CMenuBase::m_pHighlightedItem, m_pParentMenu, wGui::CWindow::m_pParentWindow, wGui::CWindow::m_WindowRect, wGui::CMessage::MessageType(), wGui::CMessage::MOUSE_BUTTONDOWN, wGui::SMenuItem::pPopup, wGui::CRect::RELPOS_INSIDE, wGui::CWindow::ROOT, ShowActivePopup(), wGui::CRect::SizeRect(), and wGui::CWindow::ViewToWindow().
void wGui::CPopupMenu::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, this is in view coordinates |
Implements wGui::CMenuBase.
Definition at line 717 of file wg_menu.cpp.
References wGui::CWindow::ClientToView(), wGui::CWindow::GetWindowRect(), wGui::CRect::HitTest(), wGui::CWindow::m_ClientRect, wGui::CMenuBase::m_pActivePopup, wGui::CRect::RELPOS_RIGHT, Show(), wGui::CRect::TopLeft(), wGui::CRect::TopRight(), and wGui::CRect::Width().
Referenced by HandleMessage(), and OnMouseButtonDown().
CMenu* wGui::CPopupMenu::m_pParentMenu [protected] |
This is a pointer to the CMenu that acts as parent for the popup, though it's not actually the parent, because the parent for root popups should be the CView
Definition at line 292 of file wg_menu.h.
Referenced by HandleMessage(), OnMouseButtonDown(), and SetParentMenu().