MWidgets::Button Class Reference

Class that represent button widget. More...

#include <button.h>

Inheritance diagram for MWidgets::Button:

MWidgets::Widget List of all members.

Public Member Functions

 Button ()
 Constructor.
 ~Button ()
 Destructor.
virtual void Create (Widget *parent, int x, int y, int w, int h, string caption, string tooltip="", bool bflat=false)
 Create widgets window.
template<class T>
void SetOnClickHandler (T *pProcessor, void(T::*EventCallBack)(Widget *sender))
 Create event handler object for OnClick event;.
virtual void OnClick ()
 Virtual callback function for clicked event.
void SetImage (Image *pImage)
 Set buttons image and change hers style - caption is not shown.
virtual WIDGET_TYPE GetType ()
 Returns class's identifier like WINDOW or BUTTON.
void SetPressed (bool val)
 Set button state to pressed.

Protected Member Functions

virtual LRESULT OnMessage (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 Subclassing for realize tooltips.
virtual void OnCommand (WORD code, WORD id)
 Function starts callbacks.

Protected Attributes

bool m_bMouseHover
 Indicate that mouse is over button.
bool m_bFlat
 Indentify flat style drawing.
HWND m_hWndTT
 handle to the ToolTip control.
std::string m_sToolTip
 ToolTip text.
BaseEventHandlerm_pOnClickHandler
 OnClick event handler.

Detailed Description

Class that represent button widget.

Definition at line 14 of file button.h.


Constructor & Destructor Documentation

MWidgets::Button::Button (  ) 

Constructor.

Definition at line 19 of file button.cpp.

References m_bFlat, m_bMouseHover, and m_pOnClickHandler.

MWidgets::Button::~Button (  ) 

Destructor.

Definition at line 26 of file button.cpp.

References m_pOnClickHandler.


Member Function Documentation

void MWidgets::Button::Create ( Widget parent,
int  x,
int  y,
int  w,
int  h,
string  caption,
string  tooltip = "",
bool  bflat = false 
) [virtual]

Create widgets window.

Parameters:
parent parent widget.
w new Button's width.
h new Button's height.
caption new Button's caption.
tooltip tooltip text. if equals true draw flat button.

Definition at line 32 of file button.cpp.

References MWidgets::Widget::Create(), MWidgets::Widget::GetHwnd(), m_bFlat, MWidgets::Widget::m_hInstance, MWidgets::Widget::m_hWnd, m_hWndTT, and m_sToolTip.

WIDGET_TYPE MWidgets::Button::GetType (  )  [virtual]

Returns class's identifier like WINDOW or BUTTON.

Implements MWidgets::Widget.

Definition at line 161 of file button.cpp.

References MWidgets::BUTTON.

void MWidgets::Button::OnClick (  )  [virtual]

Virtual callback function for clicked event.

Definition at line 145 of file button.cpp.

References MWidgets::BaseEventHandler::Call(), and m_pOnClickHandler.

Referenced by OnCommand().

void MWidgets::Button::OnCommand ( WORD  code,
WORD  id 
) [protected, virtual]

Function starts callbacks.

Reimplemented from MWidgets::Widget.

Definition at line 139 of file button.cpp.

References OnClick().

LRESULT MWidgets::Button::OnMessage ( HWND  hWnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
) [protected, virtual]

Subclassing for realize tooltips.

Reimplemented from MWidgets::Widget.

Definition at line 86 of file button.cpp.

References m_bFlat, m_bMouseHover, MWidgets::Widget::m_hWnd, m_hWndTT, and MWidgets::Widget::OnMessage().

void MWidgets::Button::SetImage ( Image pImage  ) 

Set buttons image and change hers style - caption is not shown.

Parameters:
pImage pointer to image object.

Definition at line 153 of file button.cpp.

References MWidgets::Image::GetHBITMAP(), and MWidgets::Widget::m_hWnd.

template<class T>
void MWidgets::Button::SetOnClickHandler ( T *  pProcessor,
void(T::*)(Widget *sender)  EventCallBack 
) [inline]

Create event handler object for OnClick event;.

Parameters:
pProcessor object that own EventCallBack; method that realize event handler.

Definition at line 47 of file button.h.

References m_pOnClickHandler.

void MWidgets::Button::SetPressed ( bool  val  ) 

Set button state to pressed.

Parameters:
val if equals "true" then button become pressed.

Definition at line 166 of file button.cpp.

References MWidgets::Widget::m_hWnd.


Member Data Documentation

bool MWidgets::Button::m_bFlat [protected]

Indentify flat style drawing.

Definition at line 18 of file button.h.

Referenced by Button(), Create(), and OnMessage().

bool MWidgets::Button::m_bMouseHover [protected]

Indicate that mouse is over button.

Definition at line 17 of file button.h.

Referenced by Button(), and OnMessage().

HWND MWidgets::Button::m_hWndTT [protected]

handle to the ToolTip control.

Definition at line 19 of file button.h.

Referenced by Create(), and OnMessage().

BaseEventHandler* MWidgets::Button::m_pOnClickHandler [protected]

OnClick event handler.

Definition at line 23 of file button.h.

Referenced by Button(), OnClick(), SetOnClickHandler(), and ~Button().

std::string MWidgets::Button::m_sToolTip [protected]

ToolTip text.

Definition at line 20 of file button.h.

Referenced by Create().


The documentation for this class was generated from the following files:
Generated on Thu Oct 26 13:47:46 2006 for MWidgets by  doxygen 1.4.7