#include <GToolBar.h>
Public Member Functions | |
const char * | GetClass () |
virtual void | OnButtonClick (GToolButton *Btn) |
Called when a button is clicked. | |
bool | IsVertical () |
True if the toolbar should layout in a vertical manner. | |
void | IsVertical (bool v) |
True if the toolbar should layout in a vertical manner. | |
bool | TextLabels () |
Shows text labels under the buttons. | |
void | TextLabels (bool i) |
Shows text labels under the buttons. | |
bool | IsCustomizable () |
Returns true if the the customizable menu is on [default: off]. | |
void | Customizable (GDom *Store=0, const char *Option=0) |
Switch for the customization menu. | |
bool | SetBitmap (char *File, int Bx, int By) |
Sets the image list to use via a file. | |
bool | SetDC (GSurface *pDC, int Bx, int By) |
Sets the image list to use via a memory surface. | |
GImageList * | GetImageList () |
Gets the image list. | |
bool | SetImageList (GImageList *l, int Bx, int By, bool Own=true) |
Sets the image list to use. | |
GFont * | GetFont () |
Gets the font used to draw the text below the buttons. | |
GToolButton * | AppendButton (const char *Tip, int Id, int Type=TBT_PUSH, int Enabled=true, int IconId=-1) |
Adds a button to the toolbar. | |
bool | AppendControl (GView *Ctrl) |
Appends any old control. | |
bool | AppendSeparator () |
Append a separator. | |
bool | AppendBreak () |
Append a line break (wraps the buttons onto the next line). | |
void | Empty () |
Empties the toolbar of buttons. | |
int | Length () |
Gets the number of buttons. | |
int | OnEvent (GMessage *Msg) |
Handles the incoming events. | |
void | OnPaint (GSurface *pDC) |
Called to paint the onscreen representation of the view. | |
void | OnMouseClick (GMouse &m) |
The mouse was clicked over this view. | |
void | OnMouseEnter (GMouse &m) |
Mouse moves into the area over the control. | |
void | OnMouseExit (GMouse &m) |
Mouse leaves the area over the control. | |
void | OnMouseMove (GMouse &m) |
The mouse moves over the control. | |
bool | Pour (GRegion &r) |
void | OnCreate () |
The view is attached. | |
Friends | |
class | GToolButton |
A toolbar hosts buttons and separators in a row. The buttons contain icons and optionally text describing there function. When the user clicks a button a M_COMMAND message is passed up to the owning GWindow for the application to handle. In the same fashion as a menu command being clicked. You should override GWindow::OnCommand to catch events from a GToolBar.
This should be attached to the GWindow before other windows so that it lays itself out under the menu.
To initialize and attach a toolbar to your GWindow use something like:
GToolBar *t = LgiLoadToolbar(this, "icons.png"); if (t) { t->Attach(this); t->AppendButton("Open", IDM_OPEN, TBT_PUSH); t->AppendSeparator(); t->AppendButton("Help", IDM_HELP, TBT_PUSH); }
const char* GToolBar::GetClass | ( | ) | [inline] |
The class' name. Should be overriden in child classes to return the right class name. Mostly used for debugging, but in the win32 port it is also the default WIN32 class name passed to RegisterClass() in GView::CreateClass().
Reimplemented from GLayout.
void GToolBar::Customizable | ( | GDom * | Store = 0 , |
|
const char * | Option = 0 | |||
) |
Switch for the customization menu.
Store | Set this to the properties store to switch on the right click menu, or NULL to switch it off. |
Option | This is the property that the toolbar stores state under. It should be unique for every toolbar. |
GToolButton * GToolBar::AppendButton | ( | const char * | Tip, | |
int | Id, | |||
int | Type = TBT_PUSH , |
|||
int | Enabled = true , |
|||
int | IconId = -1 | |||
) |
Adds a button to the toolbar.
Tip | The buttons help tip |
Id | The ID to post to the main window when activated |
Type |
The type of button
|
Enabled | Whether to enable the button |
IconId | The index into the image list to use on the button |
References GView::Enabled(), GToolButton::ImgIndex, GToolButton::Name(), GView::SetId(), GView::SetParent(), and GToolButton::Type.
bool GToolBar::Pour | ( | GRegion & | r | ) | [virtual] |
Lay out all the children views into the client area according to their own internal rules. Space is given in a first come first served basis.
Reimplemented from GLayout.
References GRect::Bound(), GView::FindLargestEdge(), List< Type >::First(), GV_EDGE_TOP, GToolButton::Image(), GToolButton::Layout(), GArray< Type >::Length(), List< Type >::Next(), GRect::Offset(), GView::Raised(), GToolButton::Separator(), GView::SetPos(), GView::Sunken(), GToolButton::Text, GRect::X(), GDisplayString::X(), GRect::x1, GRect::x2, GRect::Y(), GDisplayString::Y(), GRect::y1, GRect::y2, and GRect::ZOff().