#include <wg_button.h>
Inheritance diagram for wGui::CButton:
Definition at line 42 of file wg_button.h.
wGui::CButton::CButton | ( | const CRect & | WindowRect, | |
CWindow * | pParent, | |||
std::wstring | sText, | |||
CFontEngine * | pFontEngine = 0 | |||
) |
Constructs a new button
WindowRect | A CRect that defines the outer limits of the control | |
pParent | A pointer to the parent window | |
sText | The text on the button | |
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 37 of file wg_button.cpp.
References Draw(), wGui::CApplication::GetDefaultFontEngine(), wGui::CApplication::GetDefaultForegroundColor(), wGui::CRenderedString::HALIGN_CENTER, wGui::CMessageServer::Instance(), wGui::CApplication::Instance(), wGui::CWindow::m_BackgroundColor, m_pFontEngine, m_pRenderedString, wGui::CWindow::m_sWindowText, wGui::CMessage::MOUSE_BUTTONUP, wGui::CMessageServer::RegisterMessageClient(), and wGui::CRenderedString::VALIGN_CENTER.
EState wGui::CButton::GetButtonState | ( | void | ) | const [inline] |
Gets the current state of the button
Definition at line 65 of file wg_button.h.
References m_eButtonState.
void wGui::CButton::SetButtonState | ( | EState | eState | ) |
Set the button state
eState | The button state |
Definition at line 66 of file wg_button.cpp.
References Draw(), and m_eButtonState.
Referenced by HandleMessage(), OnMouseButtonDown(), and OnMouseButtonUp().
void wGui::CButton::SetWindowText | ( | const std::wstring & | sWindowText | ) | [virtual] |
Set the WindowText of the button
sWindowText | The text to assign to the window |
Reimplemented from wGui::CWindow.
Definition at line 116 of file wg_button.cpp.
References wGui::CRenderedString::HALIGN_CENTER, m_pFontEngine, m_pRenderedString, wGui::CWindow::SetWindowText(), and wGui::CRenderedString::VALIGN_CENTER.
bool wGui::CButton::OnMouseButtonDown | ( | CPoint | Point, | |
unsigned int | Button | |||
) | [virtual] |
This is called whenever the button 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::CWindow.
Definition at line 125 of file wg_button.cpp.
References DOWN, wGui::CRect::HitTest(), wGui::CWindow::m_bVisible, wGui::CWindow::m_ClientRect, m_eButtonState, m_MouseButton, wGui::CWindow::OnMouseButtonDown(), wGui::CRect::RELPOS_INSIDE, SetButtonState(), UP, and wGui::CWindow::ViewToWindow().
bool wGui::CButton::OnMouseButtonUp | ( | CPoint | Point, | |
unsigned int | Button | |||
) | [virtual] |
This is called whenever the a mouse button is released in the button 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::CWindow.
Definition at line 140 of file wg_button.cpp.
References wGui::CMessage::CTRL_SINGLELCLICK, wGui::CMessage::CTRL_SINGLEMCLICK, wGui::CMessage::CTRL_SINGLERCLICK, DOWN, wGui::CRect::HitTest(), wGui::CMessageServer::Instance(), wGui::CMouseMessage::LEFT, wGui::CWindow::m_bVisible, wGui::CWindow::m_ClientRect, m_eButtonState, m_MouseButton, wGui::CWindow::m_pParentWindow, wGui::CMouseMessage::MIDDLE, wGui::CWindow::OnMouseButtonUp(), wGui::CMessageServer::QueueMessage(), wGui::CRect::RELPOS_INSIDE, wGui::CMouseMessage::RIGHT, SetButtonState(), wGui::CMessage::UNKNOWN, UP, and wGui::CWindow::ViewToWindow().
bool wGui::CButton::HandleMessage | ( | CMessage * | pMessage | ) | [virtual] |
CButtons handle MOUSE_BUTTONDOWN and MOUSE_BUTTONUP messages
pMessage | A pointer to the message |
Reimplemented from wGui::CWindow.
Definition at line 169 of file wg_button.cpp.
References DOWN, wGui::CWindow::HandleMessage(), m_eButtonState, wGui::CMessage::MessageType(), wGui::CMessage::MOUSE_BUTTONUP, SetButtonState(), and UP.