ToolBar
Compact command toolbar with grouped buttons, separators, and command manager integration.
Overview
Compact command toolbar with grouped buttons, separators, and command manager integration. Provides extensive layout configuration and interaction capabilities.
Basic Usage
ToolBar toolbar = new ToolBar();
toolbar.command("edit.undo", "icon:undo", ToolButton.DisplayMode.ICON_ONLY);
toolbar.separator();
toolbar.command("edit.redo", "icon:redo", ToolButton.DisplayMode.ICON_ONLY);
Related links
- MenuBar: Top-level horizontal menu bar hosting dropdown menus with command binding, keyboard accelerators, and popup coordination.
API
ToolBar()
Constructs a horizontal ToolBar instance with default 26px height and spacing.
ToolBar::button(ToolButton)
Adds a ToolButton to the toolbar and binds it to the command manager if configured.
| Parameter | Type | Description |
|---|---|---|
button |
ToolButton |
The button instance. |
Returns ToolBar: This instance for chaining..
ToolBar::command(String)
Adds a command button by ID using text-only display mode.
| Parameter | Type | Description |
|---|---|---|
commandId |
String |
The command identifier. |
Returns ToolButton: The created or added ToolButton..
ToolBar::command(String, String, DisplayMode)
Adds a command button with command ID, icon, and display mode.
| Parameter | Type | Description |
|---|---|---|
commandId |
String |
The command identifier. |
icon |
String |
The icon identifier or handle. |
displayMode |
DisplayMode |
The button display mode. |
Returns ToolButton: The created or added ToolButton..
ToolBar::commandManager()
Returns the CommandManager associated with this toolbar.
Returns CommandManager: The associated CommandManager..
ToolBar::commandManager(CommandManager)
Sets the CommandManager used by toolbar command buttons.
| Parameter | Type | Description |
|---|---|---|
commandManager |
CommandManager |
The CommandManager instance. |
Returns ToolBar: This instance for chaining..
ToolBar::iconCommand(String, String)
Adds an icon-only command button bound to the command manager.
| Parameter | Type | Description |
|---|---|---|
commandId |
String |
The command identifier. |
icon |
String |
The icon identifier or handle. |
Returns IconButton: The created or added IconButton..
ToolBar::refreshCommandButtons()
Refreshes labels, enabled state, and checked state for all command buttons.
Returns ToolBar: This instance for chaining..
ToolBar::separator()
Appends a vertical separator dividing button groups.
Returns ToolBar: This instance for chaining..
ToolBar::spacer()
Appends a flexible expanding spacer pushing trailing buttons to the right.
Returns ToolBar: This instance for chaining..
ToolBar::toggleCommand(String, String, DisplayMode)
Adds a toggleable tool button bound to a command.
| Parameter | Type | Description |
|---|---|---|
commandId |
String |
The command identifier. |
icon |
String |
The icon identifier or handle. |
displayMode |
DisplayMode |
The button display mode. |
Returns ToggleToolButton: The created or added ToggleToolButton..
ToolBar::widget(Widget)
Appends an arbitrary custom widget to the toolbar.
| Parameter | Type | Description |
|---|---|---|
widget |
Widget |
The widget component. |
Returns ToolBar: This instance for chaining..