wGui::CButton Class Reference

The button will generate CTRL_xCLICK messages when clicked with the mouse (where x is the button L,M,R). More...

#include <wg_button.h>

Inheritance diagram for wGui::CButton:

wGui::CWindow wGui::CMessageClient wGui::CPictureButton

Public Types

Public Member Functions

Protected Attributes


Detailed Description

The button will generate CTRL_xCLICK messages when clicked with the mouse (where x is the button L,M,R).

Definition at line 42 of file wg_button.h.


Member Enumeration Documentation

enum wGui::CButton::EState

The button state.

Enumerator:
UP  The button is up.
DOWN  The button is down.
DISABLED  The button is disabled.

Definition at line 57 of file wg_button.h.


Constructor & Destructor Documentation

wGui::CButton::CButton ( const CRect WindowRect,
CWindow pParent,
std::wstring  sText,
CFontEngine pFontEngine = 0 
)

Constructs a new button

Parameters:
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.


Member Function Documentation

EState wGui::CButton::GetButtonState ( void   )  const [inline]

Gets the current state of the button

Returns:
The current button state

Definition at line 65 of file wg_button.h.

References m_eButtonState.

void wGui::CButton::SetButtonState ( EState  eState  ) 

Set the button state

Parameters:
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

Parameters:
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

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 button

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

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 button

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

Parameters:
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.


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