Use the function LgiLoadToolbar to allocate the object and load the image list in from a graphics file:
GToolBar *LgiLoadToolbar(GWindow *Parent, char *File, int x = 24, int y = 24);
![]() |
class GToolBar : public GLayout { public: // _Constructor ~GToolBar() GToolBar() // Buttons bool AppendBreak() bool AppendControl(GWindow *Ctrl) bool AppendSeparator() bool Delete(GWindow *Ctrl) virtual GToolButton *AppendButton(char *Tip, int Id, int Type = TBT_PUSH, int Enabled = TRUE, int IconId = -1) void Empty() // Properties bool IsVertical(bool i) bool IsVertical() bool SetBitmap(char *File, int Bx, int By) bool SetDC(GdcBasePrimitives *pDC, int Bx, int By) bool SetImageList(bool Own = true, GImageList *l, int Bx, int By) }; |
Destroys the toolbar.
Constructs the toolbar.
A break wraps the buttons onto the next line. This allows multi column tool bars.
Argument | Description |
GWindow *Ctrl | Control to append. |
You can append custom controls on the toolbar. Things like edit and combo boxes. Build a class for the control and then pass an instance into this function. The X() and Y() functions of the window will be used to determin it's size and allocated space for the window in the toolbar.
Inserts a separator between buttons. A separator can be used to group buttons with the radio style. Radio buttons only allow one option to be selected from their group at a time.
Argument | Description |
GWindow *Ctrl | The button to delete. |
Deletes the specified button.
Argument | Description |
char *Tip |
The tooltip for the button to display when the mouse is over the button.
Note: Not currently implemented on BeOS. |
int Id | The command id to return to the main window OnCommand handler when the button is pressed. |
int Type = TBT_PUSH |
The type of the button. Can be:
|
int Enabled = TRUE | Whether the button should be enbled. |
int IconId = -1 | The index of the icon in the image list to use on the button. Requires that you have set the image list of the toolbar. |
Append a button to the toolbar.
Empties all the buttons out of the toolbar.
Argument | Description |
bool i |
Sets the toolbars orientation.
Returns true if the toolbar is vertical and therefor down the lefthand side of the container or false if the toolbar is horizontal and along the top of the container.
Argument | Description |
char *File | The filename of the graphics file. |
int Bx, int By | The size of the buttons. Typically 16x16 or 24x24. |
Sets the bitmap containing the graphics for the toolbar buttons.
Argument | Description |
GdcBasePrimitives *pDC | Pointer to bitmap in memory. |
int Bx, int By | Size of the buttons. |
Sets the bitmap used to draw the button faces.
Buttons are allocated part of the bitmap starting from the first button taking Bx pixels from the left, and then the next (non-separator) button taking the next Bx pixels and so on.
Argument | Description |
bool Own = true | true if the toolbar is going to be responsible for deleting the ImageList. |
GImageList *l | The list of images to use on the buttons. |
int Bx, int By | The size of the buttons. |
By using an image list for the button faces you can assign images to buttons out of order, using some or all of the available images in the list. Unlike the SetDC and SetBitmap functions that allocate images in sequential order.
When using the image list you can specify the image to use on the button when you append the button.