GToolBar Class Reference

A top level window toolbar. More...

#include <GToolBar.h>

Inheritance diagram for GToolBar:

GLayout GView

List of all members.

Public Member Functions

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, 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.
GImageListGetImageList ()
 Gets the image list.
bool SetImageList (GImageList *l, int Bx, int By, bool Own=true)
 Sets the image list to use.
GFontGetFont ()
 Gets the font used to draw the text below the buttons.
GToolButtonAppendButton (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 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


Detailed Description

A top level window toolbar.

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);
    }

Member Function Documentation

GToolButton * GToolBar::AppendButton ( char *  Tip,
int  Id,
int  Type = TBT_PUSH,
int  Enabled = true,
int  IconId = -1 
)

Adds a button to the toolbar.

Parameters:
Tip  The buttons help tip
Id  The ID to post to the main window when activated
Type  The type of button
See also:
The define TBT_PUSH and below
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.

void GToolBar::Customizable ( GDom Store = 0,
char *  Option = 0 
)

Switch for the customization menu.

Parameters:
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.

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().

Returns:
the Class' name for debugging

Reimplemented from GLayout.

bool GToolBar::Pour ( GRegion r  )  [virtual]


The documentation for this class was generated from the following files:

Generated on Wed Dec 1 15:41:04 2010 for Lgi by  doxygen 1.5.7.1