wGui::CToolBar Class Reference

Toolbars support CButton derived controls. More...

#include <wg_toolbar.h>

Inheritance diagram for wGui::CToolBar:

wGui::CWindow wGui::CMessageClient

Public Member Functions

Protected Types

Protected Member Functions

Protected Attributes


Detailed Description

Toolbars support CButton derived controls.

Definition at line 40 of file wg_toolbar.h.


Constructor & Destructor Documentation

wGui::CToolBar::CToolBar ( const CRect WindowRect,
CWindow pParent 
)

Constructs a new ToolBar

Parameters:
WindowRect A CRect that defines the outer limits of the control
pParent A pointer to the parent window

Definition at line 34 of file wg_toolbar.cpp.

References wGui::COLOR_LIGHTGRAY, wGui::CMessage::CTRL_SINGLELCLICK, wGui::CWindow::Draw(), wGui::CMessageServer::Instance(), wGui::CWindow::m_BackgroundColor, and wGui::CMessageServer::RegisterMessageClient().


Member Function Documentation

void wGui::CToolBar::InsertButton ( CButton pButton,
long int  iButtonID = 0,
unsigned int  iPosition = 0 
)

Add a button to the toolbar The toolbar will become the button's parent The toolbar will catch all CTRL_SINGLELCLICK messages from the buttons and will post a CTRL_SINGLELCLICK message from the toolbar with the iButtonID value as the iNewValue

Parameters:
pButton A pointer to the button to be inserted, inserts a spacer if this is NULL
iButtonID An identifier that the toolbar will return when a button is clicked on, defaults to 0
iPosition The position to insert the button at (defaults to adding to the beginning of the toolbar)

Definition at line 49 of file wg_toolbar.cpp.

References m_vpButtons, RepositionButtons(), and wGui::CWindow::SetNewParent().

Referenced by AppendButton().

void wGui::CToolBar::AppendButton ( CButton pButton,
long int  iButtonID = 0 
)

Add a button to the end of toolbar The toolbar will become the button's parent The toolbar will catch all CTRL_SINGLELCLICK messages from the buttons and will post a CTRL_SINGLELCLICK message from the toolbar with the iButtonID value as the iNewValue

Parameters:
pButton A pointer to the button to be inserted, inserts a spacer if this is NULL
iButtonID An identifier that the toolbar will return when a button is clicked on, defaults to 0

Definition at line 68 of file wg_toolbar.cpp.

References InsertButton(), and m_vpButtons.

void wGui::CToolBar::RemoveButton ( unsigned int  iPosition  ) 

Remove a button from the toolbar This will automatically delete the button

Parameters:
iPosition The position of the button to remove, an exception will be thrown if this is out of range

Definition at line 74 of file wg_toolbar.cpp.

References m_vpButtons.

unsigned int wGui::CToolBar::GetButtonCount ( void   )  [inline]

Gets the number of items on the toolbar (including spacers)

Returns:
The number of buttons in the toolbar

Definition at line 77 of file wg_toolbar.h.

References m_vpButtons.

long int wGui::CToolBar::GetButtonID ( unsigned int  iPosition  )  [inline]

Parameters:
iPosition The position of the button to get the ID for. An exception will be thrown if this is out of range.
Returns:
The ButtonID of the button at the given position (spacers always return 0)

Definition at line 81 of file wg_toolbar.h.

References m_vpButtons.

int wGui::CToolBar::GetButtonPosition ( long int  iButtonID  ) 

Parameters:
iButtonID The ID of the button to get the position for
Returns:
The position of the button, or -1 if it can't find the ButtonID

Definition at line 92 of file wg_toolbar.cpp.

References m_vpButtons.

void wGui::CToolBar::SetWindowRect ( const CRect WindowRect  )  [virtual]

CWindow overrides Giving a control a new WindowRect will move and resize the control

Parameters:
WindowRect A CRect that defines the outer limits of the control

Reimplemented from wGui::CWindow.

Definition at line 130 of file wg_toolbar.cpp.

References wGui::CWindow::m_ClientRect, wGui::CWindow::m_WindowRect, RepositionButtons(), wGui::CWindow::SetWindowRect(), and wGui::CRect::SizeRect().

bool wGui::CToolBar::HandleMessage ( CMessage pMessage  )  [virtual]

CToolBars handle CTRL_SINGLELCLICK messages

Parameters:
pMessage A pointer to the message

Reimplemented from wGui::CWindow.

Definition at line 138 of file wg_toolbar.cpp.

References wGui::CMessage::CTRL_SINGLELCLICK, wGui::CMessage::Destination(), wGui::CWindow::HandleMessage(), wGui::CMessageServer::Instance(), wGui::CWindow::m_pParentWindow, m_vpButtons, wGui::CMessage::MessageType(), wGui::CMessageServer::QueueMessage(), and wGui::CMessage::Source().


The documentation for this class was generated from the following files:
Generated on Wed May 16 23:11:28 2007 for wGui by  doxygen 1.5.1