Contents Up Previous Next

Toolbar

Overview

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

toolbar-add-separator
toolbar-add-tool
toolbar-clear-tools
toolbar-create
toolbar-create-tools
toolbar-enable-tool
toolbar-get-max-height
toolbar-get-max-width
toolbar-get-tool-client-data
toolbar-get-tool-enabled
toolbar-get-tool-long-help
toolbar-get-tool-short-help
toolbar-get-tool-state
toolbar-layout
toolbar-on-paint
toolbar-set-default-size
toolbar-set-margins
toolbar-set-tool-long-help
toolbar-set-tool-short-help
toolbar-toggle-tool


toolbar-add-separator

long ( toolbar-add-separator long id)

Adds a separator between tools.


toolbar-add-tool

long ( toolbar-add-tool long id long index long bitmap-id1 optional long bitmap-id2 = 0 optional long is-toggle = 0 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 can be used for longer help strings, such as status line help.


toolbar-clear-tools

long ( toolbar-clear-tools long id)

Clears all the tools from the toolbar.


toolbar-create

long ( toolbar-create long parent_id optional long x optional long y optional long width optional long height optional string style optional string orientation = "wxVERTICAL'' optional long nrows-or-columns optional long create-buttons optional string name)

Creates a toolbar, with a given layout orientation (whether the tools are automatically laid out in rows or columns) and the number of rows or columns. These parameters are arbitrary if the tools are to be positioned manually and toolbar-layout not called.

style may be a bit list of:

create-buttons should be 1 (the default) if the toolbar should superimpose the user-supplied buttons onto a larger 3D button. If 0, the tool will be the same size as the button, and the toggle state will be represented by inverting the tool (Windows) or adding a border (X).

Returns the toolbar id if successful, zero otherwise.

name gives the toolbar a name that can be retrieved with window-get-name.

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


toolbar-create-tools

long ( toolbar-create-tools long id)

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.


toolbar-enable-tool

long ( toolbar-enable-tool long id long tool-id long enable)

Enables the tool (if enable is 1) or disables it (if enable is 0).


toolbar-get-max-height

double ( toolbar-get-max-height long id)

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


toolbar-get-max-width

double ( toolbar-get-max-width long id)

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


toolbar-get-tool-client-data

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

Returns the client data associated with the given tool.


toolbar-get-tool-enabled

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

Returns 1 if the tool is enabled, 0 otherwise.


toolbar-get-tool-long-help

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

Returns the long help associated with this tool.


toolbar-get-tool-short-help

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

Returns the short help associated with this tool.


toolbar-get-tool-state

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

Returns the tool state (1 for toggled on, 0 for off).


toolbar-layout

long ( toolbar-layout long id)

Lays out all the tools if automatic layout is required.

Note that this function does not work for buttonbars under Windows 95: but you can still specify the number of rows for the toolbar.


toolbar-on-paint

void ( toolbar-on-paint long id)

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


toolbar-set-default-size

long ( toolbar-set-default-size long id long width long height)

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


toolbar-set-margins

long ( toolbar-set-margins long id long x long y)

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


toolbar-set-tool-long-help

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

Sets the long help associated with this tool.


toolbar-set-tool-short-help

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

Sets the short help associated with this tool.


toolbar-toggle-tool

long ( toolbar-toggle-tool long id long tool-id long toggle)

Toggles the tool on or off.