#include <wg_window.h>
Inheritance diagram for wGui::CWindow:
CWindow i inherits from the CMessageClient class so that any 'window' can recieve messages CWindow provides the basic properties and methods needed to define a window Almost all controls and views will be derived from this
Definition at line 50 of file wg_window.h.
Describes the ancestor that is desired.
PARENT | return the direct parent of the window |
ROOT | climb the parent chain all the way until the root and return it |
Definition at line 95 of file wg_window.h.
The constructor will automatically register the new window with the specified parent as a child (if a parent is given) The parent is then responsible for destroying the window
WindowRect | A CRect that defines the outer limits of the control | |
pParent | A pointer to the parent window |
Definition at line 40 of file wg_window.cpp.
References wGui::CApplication::GetDefaultBackgroundColor(), wGui::CApplication::Instance(), m_BackgroundColor, SetNewParent(), and SetWindowRect().
virtual std::string wGui::CWindow::GetClassName | ( | void | ) | const [inline, virtual] |
Return the classname for the object
Definition at line 64 of file wg_window.h.
void wGui::CWindow::SetWindowRect | ( | const CRect & | WindowRect | ) | [virtual] |
Giving a control a new WindowRect will move and resize the control
WindowRect | A CRect that defines the outer limits of the control |
Reimplemented in wGui::CDropDown, wGui::CFrame, wGui::CGroupBox, wGui::CListBox, wGui::CPicture, wGui::CScrollBar, wGui::CTextBox, wGui::CToolBar, and wGui::CView.
Definition at line 76 of file wg_window.cpp.
References wUtil::CLog::AddLogEntry(), wGui::APP_LOG_ERROR, wGui::CRect::Bottom(), Draw(), wGui::CApplication::GetApplicationLog(), wGui::CApplication::GetBitsPerPixel(), wGui::CRect::Height(), wGui::CApplication::Instance(), wGui::CRect::Left(), m_ClientRect, m_pSDLSurface, m_WindowRect, wGui::CRect::Right(), wGui::CRect::Top(), stdex::ToWString(), and wGui::CRect::Width().
Referenced by wGui::CView::AttachMenu(), wGui::CFrame::AttachMenu(), CWindow(), wGui::CMessageBox::FitToText(), wGui::CView::HandleMessage(), wGui::CView::SetWindowRect(), wGui::CToolBar::SetWindowRect(), wGui::CTextBox::SetWindowRect(), wGui::CScrollBar::SetWindowRect(), wGui::CPicture::SetWindowRect(), wGui::CListBox::SetWindowRect(), wGui::CGroupBox::SetWindowRect(), wGui::CFrame::SetWindowRect(), wGui::CDropDown::SetWindowRect(), wGui::CPopupMenu::Show(), and wGui::CToolTip::ShowTip().
virtual CRect wGui::CWindow::GetWindowRect | ( | void | ) | const [inline, virtual] |
Gets the window's rectangle This is represented in the window's parent's client coordinates
Definition at line 73 of file wg_window.h.
References m_WindowRect.
Referenced by wGui::CView::AttachMenu(), wGui::CFrame::AttachMenu(), wGui::CMessageBox::FitToText(), wGui::CToolTip::HandleMessage(), wGui::CPopupMenu::HandleMessage(), wGui::CDropDown::HandleMessage(), wGui::CPopupMenu::Show(), wGui::CPopupMenu::ShowActivePopup(), and wGui::CMenu::ShowActivePopup().
void wGui::CWindow::MoveWindow | ( | const CPoint & | MoveDistance | ) | [virtual] |
Move the window and any child windows
MoveDistance | The relative distance to move the window |
Reimplemented in wGui::CDropDown, wGui::CScrollBar, and wGui::CToolTip.
Definition at line 95 of file wg_window.cpp.
References wGui::CMessage::APP_PAINT, wGui::CMessageServer::Instance(), m_WindowRect, and wGui::CMessageServer::QueueMessage().
Referenced by wGui::CToolTip::MoveWindow(), wGui::CScrollBar::MoveWindow(), and wGui::CDropDown::MoveWindow().
virtual CRect wGui::CWindow::GetClientRect | ( | void | ) | const [inline, virtual] |
The ClientRect describes the internal area of the control By default, this is initialized to the value of the WindowRect The ClientRect is useful for windows that will contain other windows Internally it's represented via the window's coordinates
Definition at line 84 of file wg_window.h.
References m_ClientRect.
Referenced by wGui::CPainter::DrawHLine(), wGui::CPainter::DrawPoint(), wGui::CPainter::DrawRect(), wGui::CPainter::DrawVLine(), wGui::CPopupMenu::HandleMessage(), wGui::CFrame::HandleMessage(), wGui::CPopupMenu::OnMouseButtonDown(), wGui::CMenu::OnMouseButtonDown(), and wGui::CPainter::ReadPoint().
virtual void wGui::CWindow::SetBackgroundColor | ( | const CRGBColor & | Color | ) | [inline, virtual] |
Set the window's background color
Color | A CRGBColor that represents the background color |
Definition at line 88 of file wg_window.h.
References m_BackgroundColor.
Referenced by wGui::CDropDown::CDropDown().
virtual CRGBColor wGui::CWindow::GetBackgroundColor | ( | void | ) | [inline, virtual] |
Retrieve a window's background color
Definition at line 92 of file wg_window.h.
References m_BackgroundColor.
GetAncestor will return an ancestor of the window (using it's parent chain) based upon the requested ancestor
eAncestor | The desired ancestor of the window |
Definition at line 102 of file wg_window.cpp.
References m_pParentWindow, PARENT, and ROOT.
Referenced by GetView(), wGui::CPopupMenu::HandleMessage(), IsChildOf(), wGui::CPopupMenu::OnMouseButtonDown(), wGui::CMenu::OnMouseButtonDown(), wGui::CPopupMenu::Show(), and wGui::CMenu::ShowActivePopup().
CView * wGui::CWindow::GetView | ( | void | ) | const [virtual] |
Gets the view the window is a part of
Definition at line 131 of file wg_window.cpp.
References GetAncestor(), and ROOT.
Referenced by wGui::CToolTip::HandleMessage(), wGui::CTextBox::HandleMessage(), wGui::CEditBox::HandleMessage(), wGui::CPopupMenu::Hide(), wGui::CDropDown::HideListBox(), wGui::CPopupMenu::Show(), and wGui::CDropDown::ShowListBox().
bool wGui::CWindow::IsChildOf | ( | CWindow * | pWindow | ) | const [virtual] |
Find out if the window is a child of another specified window
pWindow | A pointer to the window that we're testing to see if this is a child of |
Definition at line 137 of file wg_window.cpp.
References GetAncestor(), and PARENT.
virtual bool wGui::CWindow::IsVisible | ( | void | ) | [inline, virtual] |
Get the visibility of the control
Definition at line 118 of file wg_window.h.
References m_bVisible.
Referenced by wGui::CToolTip::HandleMessage(), wGui::CDropDown::HandleMessage(), wGui::CDropDown::HideListBox(), and wGui::CDropDown::ShowListBox().
void wGui::CWindow::SetVisible | ( | bool | bVisible | ) | [virtual] |
Set the visibility of the control, and all of it's children
bVisible | Set to false to hide the control |
Reimplemented in wGui::CDropDown.
Definition at line 155 of file wg_window.cpp.
References wGui::CMessage::APP_PAINT, wGui::CMessageServer::Instance(), wGui::CApplication::Instance(), m_bVisible, m_ChildWindows, wGui::CMessageServer::QueueMessage(), and wGui::CApplication::SetKeyFocus().
Referenced by wGui::CDropDown::CDropDown(), wGui::CDropDown::HideListBox(), wGui::CToolTip::HideTip(), wGui::CDropDown::SetVisible(), wGui::CDropDown::ShowListBox(), wGui::CToolTip::ShowTip(), and wGui::CTextBox::UpdateScrollBars().
virtual SDL_Surface* wGui::CWindow::GetSDLSurface | ( | void | ) | [inline, virtual] |
Gets the SDL surface the window draws to
Definition at line 126 of file wg_window.h.
References m_pSDLSurface.
Referenced by wGui::CPainter::CPainter().
Translate the given CRect into view coordinates
Rect | A CRect in client coordinates |
Definition at line 173 of file wg_window.cpp.
References ClientToView(), m_ClientRect, m_pParentWindow, m_WindowRect, and wGui::CRect::TopLeft().
Referenced by ClientToView(), and wGui::CPopupMenu::ShowActivePopup().
Translate the given CPoint into view coordinates
Point | A CPoint in client coordinates |
Definition at line 184 of file wg_window.cpp.
References ClientToView(), m_ClientRect, m_pParentWindow, m_WindowRect, and wGui::CRect::TopLeft().
Translate the given CRect from view coordinates, to the window's client coordinates
Rect | A CRect in view coordinates |
Definition at line 195 of file wg_window.cpp.
References m_ClientRect, m_pParentWindow, m_WindowRect, wGui::CRect::TopLeft(), and ViewToClient().
Referenced by wGui::CPopupMenu::Show(), wGui::CToolTip::ShowTip(), ViewToClient(), and ViewToWindow().
Translate the given CPoint from view coordinates, to the window's client coordinates
Point | A CPoint in view coordinates |
Definition at line 206 of file wg_window.cpp.
References m_ClientRect, m_pParentWindow, m_WindowRect, wGui::CRect::TopLeft(), and ViewToClient().
Translate the given CRect from view coordinates, to the window's coordinates
Rect | A CRect in view coordinates |
Definition at line 217 of file wg_window.cpp.
References m_pParentWindow, m_WindowRect, wGui::CRect::TopLeft(), and ViewToClient().
Referenced by wGui::CToolTip::HandleMessage(), wGui::CTextBox::HandleMessage(), wGui::CScrollBar::HandleMessage(), wGui::CRadioButton::HandleMessage(), wGui::CPopupMenu::HandleMessage(), wGui::CMenu::HandleMessage(), wGui::CMenuBase::HandleMessage(), wGui::CEditBox::HandleMessage(), wGui::CDropDown::HandleMessage(), wGui::CCheckBox::HandleMessage(), HitTest(), wGui::CPopupMenu::IsInsideChild(), OnMouseButtonDown(), wGui::CTextBox::OnMouseButtonDown(), wGui::CScrollBar::OnMouseButtonDown(), wGui::CRadioButton::OnMouseButtonDown(), wGui::CPopupMenu::OnMouseButtonDown(), wGui::CMenu::OnMouseButtonDown(), wGui::CListBox::OnMouseButtonDown(), wGui::CFrame::OnMouseButtonDown(), wGui::CEditBox::OnMouseButtonDown(), wGui::CCheckBox::OnMouseButtonDown(), wGui::CButton::OnMouseButtonDown(), OnMouseButtonUp(), wGui::CRadioButton::OnMouseButtonUp(), wGui::CListBox::OnMouseButtonUp(), wGui::CCheckBox::OnMouseButtonUp(), and wGui::CButton::OnMouseButtonUp().
Translate the given CPoint from view coordinates, to the window's coordinates
Point | A CPoint in view coordinates |
Definition at line 228 of file wg_window.cpp.
References m_pParentWindow, m_WindowRect, wGui::CRect::TopLeft(), and ViewToClient().
void wGui::CWindow::SetWindowText | ( | const std::wstring & | sText | ) | [virtual] |
Set the WindowText of the control
sText | The text to assign to the window |
Reimplemented in wGui::CButton, wGui::CEditBox, wGui::CFrame, wGui::CGroupBox, wGui::CLabel, wGui::CTextBox, and wGui::CView.
Definition at line 239 of file wg_window.cpp.
References Draw(), and m_sWindowText.
Referenced by wGui::CEditBox::HandleMessage(), wGui::CView::SetWindowText(), wGui::CTextBox::SetWindowText(), wGui::CLabel::SetWindowText(), wGui::CGroupBox::SetWindowText(), wGui::CFrame::SetWindowText(), wGui::CEditBox::SetWindowText(), and wGui::CButton::SetWindowText().
virtual std::wstring wGui::CWindow::GetWindowText | ( | void | ) | [inline, virtual] |
Return the WindowText for the current window
Reimplemented in wGui::CDropDown.
Definition at line 158 of file wg_window.h.
References m_sWindowText.
Referenced by wGui::CDropDown::GetWindowText().
bool wGui::CWindow::HitTest | ( | const CPoint & | Point | ) | const [virtual] |
Check to see if a point lies within the window or any of it's children
Point | the point to check against in View coordinates |
Definition at line 246 of file wg_window.cpp.
References wGui::CRect::HitTest(), m_ChildWindows, m_WindowRect, wGui::CRect::RELPOS_INSIDE, wGui::CRect::SizeRect(), and ViewToWindow().
Referenced by wGui::CToolTip::HandleMessage(), wGui::CTextBox::HandleMessage(), and wGui::CEditBox::HandleMessage().
void wGui::CWindow::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 in wGui::CFrame, wGui::CListBox, wGui::CPopupMenu, and wGui::CToolTip.
Definition at line 268 of file wg_window.cpp.
References m_bVisible, m_ChildWindows, m_ClientRect, m_pSDLSurface, m_WindowRect, wGui::CRect::SizeRect(), and wGui::CRect::TopLeft().
Referenced by wGui::CView::HandleMessage(), and wGui::CListBox::PaintToSurface().
void wGui::CWindow::SetNewParent | ( | CWindow * | pNewParent | ) | [virtual] |
Transfer the ownership of the window, so it has a new parent
pNewParent | A pointer to a window that should be set as the parent |
Definition at line 287 of file wg_window.cpp.
References DeregisterChildWindow(), m_pParentWindow, and RegisterChildWindow().
Referenced by wGui::CView::AttachMenu(), CWindow(), wGui::CToolBar::InsertButton(), wGui::CFrame::OnMouseButtonDown(), wGui::CMenu::ShowActivePopup(), and ~CWindow().
bool wGui::CWindow::OnMouseButtonDown | ( | CPoint | Point, | |
unsigned int | Button | |||
) | [virtual] |
This is called whenever the window 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 in wGui::CButton, wGui::CCheckBox, wGui::CEditBox, wGui::CFrame, wGui::CListBox, wGui::CMenuBase, wGui::CMenu, wGui::CPopupMenu, wGui::CRadioButton, wGui::CScrollBar, and wGui::CTextBox.
Definition at line 301 of file wg_window.cpp.
References wGui::CRect::HitTest(), m_bVisible, m_ChildWindows, m_WindowRect, wGui::CRect::RELPOS_INSIDE, wGui::CRect::SizeRect(), and ViewToWindow().
Referenced by wGui::CView::HandleMessage(), wGui::CTextBox::OnMouseButtonDown(), wGui::CScrollBar::OnMouseButtonDown(), wGui::CRadioButton::OnMouseButtonDown(), wGui::CListBox::OnMouseButtonDown(), wGui::CFrame::OnMouseButtonDown(), wGui::CEditBox::OnMouseButtonDown(), wGui::CCheckBox::OnMouseButtonDown(), and wGui::CButton::OnMouseButtonDown().
bool wGui::CWindow::OnMouseButtonUp | ( | CPoint | Point, | |
unsigned int | Button | |||
) | [virtual] |
This is called whenever the a mouse button is released in a window 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 in wGui::CButton, wGui::CCheckBox, wGui::CListBox, and wGui::CRadioButton.
Definition at line 321 of file wg_window.cpp.
References wGui::CRect::HitTest(), m_bVisible, m_ChildWindows, m_WindowRect, wGui::CRect::RELPOS_INSIDE, wGui::CRect::SizeRect(), and ViewToWindow().
Referenced by wGui::CView::HandleMessage(), wGui::CRadioButton::OnMouseButtonUp(), wGui::CListBox::OnMouseButtonUp(), wGui::CCheckBox::OnMouseButtonUp(), and wGui::CButton::OnMouseButtonUp().
bool wGui::CWindow::HandleMessage | ( | CMessage * | pMessage | ) | [virtual] |
Attempt to handle the given message CWindows handle any APP_PAINT messages that have them marked as the destination
Implements wGui::CMessageClient.
Reimplemented in wGui::CButton, wGui::CCheckBox, wGui::CDropDown, wGui::CEditBox, wGui::CFrame, wGui::CListBox, wGui::CMenuBase, wGui::CMenu, wGui::CPopupMenu, wGui::CMessageBox, wGui::CRadioButton, wGui::CScrollBar, wGui::CTextBox, wGui::CToolBar, wGui::CToolTip, and wGui::CView.
Definition at line 362 of file wg_window.cpp.
Referenced by wGui::CView::HandleMessage(), wGui::CToolTip::HandleMessage(), wGui::CToolBar::HandleMessage(), wGui::CTextBox::HandleMessage(), wGui::CScrollBar::HandleMessage(), wGui::CRadioButton::HandleMessage(), wGui::CMenuBase::HandleMessage(), wGui::CListBox::HandleMessage(), wGui::CFrame::HandleMessage(), wGui::CEditBox::HandleMessage(), wGui::CDropDown::HandleMessage(), wGui::CCheckBox::HandleMessage(), and wGui::CButton::HandleMessage().
void wGui::CWindow::RegisterChildWindow | ( | CWindow * | pWindow | ) | [protected, virtual] |
Register pWindow as a child
pWindow | A pointer to the child window |
Definition at line 341 of file wg_window.cpp.
References wUtil::CLog::AddLogEntry(), wGui::APP_LOG_ERROR, wGui::CApplication::GetApplicationLog(), wGui::CApplication::Instance(), and m_ChildWindows.
Referenced by SetNewParent().
void wGui::CWindow::DeregisterChildWindow | ( | CWindow * | pWindow | ) | [protected, virtual] |
Deregister pWindow as a child
pWindow | A pointer to the child window |
Definition at line 356 of file wg_window.cpp.
References m_ChildWindows.
Referenced by SetNewParent().