#include <ToolBar.h>
Public Member Functions | |
ToolSet (Widget *parent, Style style=ToolSetStyle) | |
virtual | ~ToolSet () |
int | getButtonCount () |
(TB_BUTTONCOUNT). | |
int | getRows () |
(TB_GETROWS) | |
Rect | setRows (int rows, bool expand) |
(TB_SETROWS) | |
void | setImageList (ImageList &imageList) |
(TB_SETIMAGELIST) | |
void | loadStandardImageList (int imageListId=IDB_STD_SMALL_COLOR) |
void | addButton (ToolButton *button) |
Adds a button to the ToolSet. | |
void | addSeparator (int width=6) |
Adds a separator in the ToolSet. | |
void | updateButton (ToolButton *button) |
ToolButton * | getButtonById (CommandId id) |
ToolButton * | getButtonByIndex (int index) |
int | hitTest (const Point &pt) |
Returns the index of the button that is above the point pt (relative to client area). | |
std::vector< Size > | getPreferredSizes () |
void | updatePreferredSizes () |
Updates the preferred sizes of the tool-set when it has different number of rows. | |
Protected Member Functions | |
virtual void | onPreferredSize (Size &sz) |
It should calculates the preferred size for this widget. | |
virtual void | onUpdateIndicators () |
Event called to update the state of indicators. | |
virtual bool | onReflectedCommand (int id, int code, LRESULT &lResult) |
This method can be used to handle command notifications (WM_COMMAND (W32)) reflected from the parent. | |
virtual bool | wndProc (UINT message, WPARAM wParam, LPARAM lParam, LRESULT &lResult) |
The customized window procedure for this particular widget. | |
Private Attributes | |
std::vector< Size > | m_preferredSizes |
HIMAGELIST | m_loadedImageList |
ToolSet::~ToolSet | ( | ) | [virtual] |
int ToolSet::getButtonCount | ( | ) |
(TB_BUTTONCOUNT).
int ToolSet::getRows | ( | ) |
(TB_GETROWS)
Rect ToolSet::setRows | ( | int | rows, | |
bool | expand | |||
) |
(TB_SETROWS)
void ToolSet::setImageList | ( | ImageList & | imageList | ) |
(TB_SETIMAGELIST)
void ToolSet::loadStandardImageList | ( | int | imageListId = IDB_STD_SMALL_COLOR |
) |
imageListId |
|
void ToolSet::addButton | ( | ToolButton * | button | ) |
Adds a button to the ToolSet.
It uses Win32's TB_INSERTBUTTON with BTNS_BUTTON.
imageIndex | The images to use for this button from the ImageList that you specified to setImageList(). | |
id | Identifier of the command. This is the identifier that will be sent to Widget::onCommand. | |
buttonState | One of the following values:
|
void ToolSet::addSeparator | ( | int | width = 6 |
) |
Adds a separator in the ToolSet.
It uses Win32's TB_INSERTBUTTON with BTNS_SEP.
void ToolSet::updateButton | ( | ToolButton * | button | ) |
ToolButton * ToolSet::getButtonById | ( | CommandId | id | ) |
ToolButton * ToolSet::getButtonByIndex | ( | int | index | ) |
int ToolSet::hitTest | ( | const Point & | pt | ) |
Returns the index of the button that is above the point pt (relative to client area).
Returns a negative index if the point is inside a (or the nearest of) a separator button.
It uses Win32's TB_HITTEST.
std::vector< Size > ToolSet::getPreferredSizes | ( | ) |
void ToolSet::updatePreferredSizes | ( | ) |
Updates the preferred sizes of the tool-set when it has different number of rows.
void ToolSet::onPreferredSize | ( | Size & | sz | ) | [protected, virtual] |
It should calculates the preferred size for this widget.
sz | It's for input and output. You should put the preferred size in this value, but also you should read the input value to know if you must to fit the widget in some size. The possible values for sz are:
|
Reimplemented from Vaca::Widget.
void ToolSet::onUpdateIndicators | ( | ) | [protected, virtual] |
Event called to update the state of indicators.
Reimplemented from Vaca::Widget.
bool ToolSet::onReflectedCommand | ( | int | id, | |
int | code, | |||
LRESULT & | lResult | |||
) | [protected, virtual] |
This method can be used to handle command notifications (WM_COMMAND
(W32)) reflected from the parent.
id | Identifier of the control or menu item. | |
code | Notification code. | |
lResult | Result to return by the wndProc method. |
Reimplemented from Vaca::Widget.
bool ToolSet::wndProc | ( | UINT | message, | |
WPARAM | wParam, | |||
LPARAM | lParam, | |||
LRESULT & | lResult | |||
) | [protected, virtual] |
The customized window procedure for this particular widget.
This method is called to intercept any message after the creation of the widget, and before the destruction. To intercept messages outside that range (before creation, and after disposition), you should customize defWndProc().
This method mainly converts a message to a event:
WM_PAINT
-> onPaint() WM_SIZE
-> onResize() WM_SETCURSOR
-> onSetCursor() WM_*BUTTONDOWN
-> onMouseDown() WM_*BUTOTNUP
-> onMouseUp() WM_*BUTOTNDBLCLK
-> onDoubleClick() WM_MOUSEMOVE
-> onMouseMove() WM_MOUSEWHEEL
-> onMouseWheel() WM_MOUSELEAVE
-> onMouseLeave() WM_CANCELMODE
-> onCancelMode() WM_CHAR
-> onKeyDown() WM_KEYDOWN
-> onKeyDown() WM_KEYUP
-> onKeyUp() WM_SETFOCUS
-> onGotFocus() WM_KILLFOCUS
-> onLostFocus() For reflection, it does:
WM_COMMAND
is received, the onReflectedCommand() event of the child is called when it is a WM_COMMAND from a control, or the onCommand() event of this widget is called when the command come from a menu or an accelerator. WM_NOTIFY
is received, the onReflectedNotify() event of the child is called. WM_DRAWITEM
is received, the onReflectedDrawItem() event of the child is called. How to extend widget::wndProc method?
class MyWidget : public Widget { ... protected: virtual bool wndProc(UINT message, WPARAM wParam, LPARAM lParam, LRESULT& lResult) { if (Widget::wndProc(message, wParam, lParam, lResult)) return true; // ...Your code here... return false; } ... }
Reimplemented from Vaca::Widget.
std::vector<Size> Vaca::ToolSet::m_preferredSizes [private] |
HIMAGELIST Vaca::ToolSet::m_loadedImageList [private] |