Contents Up Previous Next

wxToolBar is-a wxPanel

Overview

A toolbar is an array of bitmap buttons, implemented by drawing bitmaps onto a canvas, instead of using the native button implementation.

Note: under XView, wxToolBar inherits from wxCanvas, not wxPanel, due to limitations in the XView toolkit.

wxToolBar create-buttons
wxToolBar orientation
wxToolBar rows-or-columns
wxToolBar add-separator
wxToolBar add-tool
wxToolBar clear-tools
wxToolBar create
wxToolBar create-tools
wxToolBar enable-tool
wxToolBar get-max-height
wxToolBar get-max-width
wxToolBar get-tool-client-data
wxToolBar get-tool-enabled
wxToolBar get-tool-long-help
wxToolBar get-tool-short-help
wxToolBar get-tool-state
wxToolBar layout
wxToolBar on-paint
wxToolBar set-default-size
wxToolBar set-margins
wxToolBar set-tool-long-help
wxToolBar set-tool-short-help
wxToolBar toggle-tool


wxToolBar create-buttons

bool create-buttons

Specify TRUE if the enhanced underlying wxButtonBar class is to be used (optimized for Windows), FALSE for the standard wxToolBar class. The default is TRUE.


wxToolBar orientation

string orientation

Specify wxVERTICAL for vertical layout, or wxHORIZONTAL for horizontal layout. Ignored if doing manual layout.


wxToolBar rows-or-columns

long rows-or-columns

The maximum number of rows or columns in this toolbar (depends on the value of orientation. Ignored if doing manual layout.


wxToolBar add-separator

bool ( add-separator long id)

Adds a separator between tools: only functional under Windows 95, but harmless under other platforms.


wxToolBar add-tool

bool ( add-tool long id long index wxBitmap bitmap1 optional wxBitmap bitmap2 = nil optional bool is-toggle = FALSE optional double x = -1.0 optional double x = 1.0 optional long client-data = 0 optional string short-help-string="" optional string long-help-string="")

Adds a tool to the toolbar. Pass at least one bitmap, the bitmap to be displayed when active and not depressed; and optionally, the bitmap to be displayed when the tool is depressed or toggled. Under Windows, only one bitmap is necessary, and under X, the second bitmap will be created automatically as the inverse of the first button if none is supplied.

You can specify whether the tool is allowed to toggle, and pass a position if you are not going to automatically layout the toolbar with toolbar-layout. You can associate client data with the tool.

short-help-string is only used by Windows 95 versions of wxCLIPS. The string is used to supply text for a tooltip, a small yellow window that appears as the mouse pointer hovers over the button.

long-help-string specifies a longer help string that can be used by the application.


wxToolBar clear-tools

bool ( clear-tools)

Clears all the tools from the toolbar.


wxToolBar create

void ( create)

Creates a toolbar. The following slots may be initialized.

style may be a bit list of:

Note that absolute tool positioning (or the layout function) does not work for buttonbars under Windows 95: instead, you can specify the number of rows for the toolbar, and use add-separator to achieve inter-tool spacing.


wxToolBar create-tools

bool ( create-tools)

This should be called when creating Windows 95 buttonbars, after all tools have been added. It adds the tools to the toolbar. You can also call it for non-Windows 95 toolbars and buttonbars, in which case it will have no effect.


wxToolBar enable-tool

bool ( enable-tool long tool-id bool enable)

Enables the tool (if enable is TRUE) or disables it (if enable is FALSE).


wxToolBar get-max-height

double ( get-max-height)

Gets the maximum height of the toolbar when it has been automatically laid out.


wxToolBar get-max-width

double ( get-max-width)

Gets the maximum width of the toolbar when it has been automatically laid out.


wxToolBar get-tool-client-data

long ( get-tool-client-data long tool-id)

Returns the client data associated with the given tool.


wxToolBar get-tool-enabled

bool ( get-tool-enabled long tool-id)

Returns TRUE if the tool is enabled, FALSE otherwise.


wxToolBar get-tool-long-help

string ( get-tool-long-help long tool-id)

Returns the long help string.


wxToolBar get-tool-short-help

string ( get-tool-short-help long tool-id)

Returns the short help string.


wxToolBar get-tool-state

bool ( get-tool-state long tool-id)

Returns the tool state (TRUE for toggled on, FALSE for off).


wxToolBar layout

bool ( layout)

Lays out all the tools if automatic layout is required.


wxToolBar on-paint

void ( on-paint)

Calls the default toolbar paint handler. You may wish to call this if you override the default handler.


wxToolBar set-default-size

bool ( set-default-size long width long height)

Sets the width and height of tool buttons (Windows only). The default is 24 by 22.


wxToolBar set-margins

bool ( set-margins long x long y)

Sets the width and height of the toolbar margins and spacing, if automatic layout is being used.


wxToolBar set-tool-long-help

bool ( set-tool-long-help long tool-id string help-string)

Sets the long help string for this tool.


wxToolBar set-tool-short-help

bool ( set-tool-short-help long tool-id string help-string)

Sets the short help string for this tool.


wxToolBar toggle-tool

bool ( toggle-tool long tool-id bool toggle)

Toggles the tool on or off.