back to gui 

wxToolBar

generated from ../src/mod_gui/control/toolbar.cpp

A toolbar.

Event handling is done as follows: When the tool has a function set as onTool, then that function will be executed. When a menu exists with the same id of the selected tool, the menu action is executed. When there is no menu, the action associated with the toolbar is executed. See actions and actions

See also createToolBar

Constants

Styles

Name Description
FLAT Gives the toolbar a flat look ('coolbar' or 'flatbar' style). Windows 95 and GTK 1.2 only.
DOCKABLE Makes the toolbar floatable and dockable. GTK only.
HORIZONTAL Specifies horizontal layout.
VERTICAL Specifies vertical layout (not available for the GTK and Windows 95 toolbar).
3DBUTTONS Gives wxToolBarSimple a mild 3D look to its buttons.
TEXT Show the text in the toolbar buttons; by default only icons are shown.
NOICONS Specifies no icons in the toolbar buttons; by default they are shown.
NODIVIDER Specifies no divider above the toolbar; by default it is shown. Windows only.
NOALIGN Specifies no alignment with the parent window. Windows only.

Constructor

wxToolBar

wxToolBar()
 
wxToolBar(Parent, 
          Id, 
          Position = wxDefaultPosition, 
          Size, 
          Style = wxToolBar.HORIZONTAL | wxToolBar.NO_BORDER)
 
Name Type Default Description
Parent wxWindow The parent of wxToolBar.
Id Integer An window identifier. Use -1 when you don't need it.
Position wxPoint wxDefaultPosition The position of the ToolBar control on the given parent.
Size wxSize The size of the ToolBar control.
Style Integer wxToolBar.HORIZONTAL | wxToolBar.NO_BORDER The wxToolBar style.

Constructs a new wxToolBar object.

Properties

Name Type Description
actions Array An array containing the function callbacks. A function will be called when a tool is selected. Use the id as index of the array.
margins wxSize Gets/Sets the left/right and top/bottom margins, which are also used for inter-toolspacing.
toolBitmapSize wxSize Gets/Sets the size of bitmap that the toolbar expects to have. The default bitmap size is 16 by 15 pixels.
toolPacking Integer Gets/Sets the value used for spacing tools. The default value is 1. The packing is used for spacing in the vertical direction if the toolbar is horizontal, and for spacing in the horizontal direction if the toolbar is vertical.
toolSeparation Integer Gets/Sets the separator size. The default value is 5.
toolSize read only wxSize Gets the size of a whole button, which is usually larger than a tool bitmap because of added 3D effects.

Methods

addCheckTool

addCheckTool(Id, 
             Label, 
             Bitmap1, 
             Bitmap2, 
             ShortHelp = "", 
             LongHelp = "") : wxToolBarTool
 
Name Type Default Description
Id Integer An integer that may be used to identify this tool
Label String
Bitmap1 wxBitmap The primary tool bitmap for toggle and button tools.
Bitmap2 wxBitmap The second bitmap specifies the on-state bitmap for a toggle tool
ShortHelp String Used for tooltips
LongHelp String String shown in the statusbar.

Adds a new check (or toggle) tool to the toolbar.

addControl

addControl(Control)
 
Name Type Default Description
Control wxControl

Adds a control to the toolbar.

addRadioTool

addRadioTool(Id, 
             Label, 
             Bitmap1, 
             Bitmap2, 
             ShortHelp = "", 
             LongHelp = "")
 
Name Type Default Description
Id Integer An integer that may be used to identify this tool
Label String
Bitmap1 wxBitmap The primary tool bitmap for toggle and button tools.
Bitmap2 wxBitmap The second bitmap specifies the on-state bitmap for a toggle tool
ShortHelp String Used for tooltips
LongHelp String String shown in the statusbar.

Adds a new radio tool to the toolbar. Consecutive radio tools form a radio group such that exactly one button in the group is pressed at any moment, in other words whenever a button in the group is pressed the previously pressed button is automatically released. You should avoid having the radio groups of only one element as it would be impossible for the user to use such button.

By default, the first button in the radio group is initially pressed, the others are not.

addSeparator

addSeparator()
 

Adds a separator for spacing groups of tools.

addTool

addTool(Id, 
        Label, 
        Bitmap1, 
        ShortHelp = "", 
        Kind = wxItemKind.NORMAL) : wxToolBarTool
 
Name Type Default Description
Id Integer An integer that may be used to identify this tool
Label String
Bitmap1 wxBitmap The primary tool bitmap for toggle and button tools.
ShortHelp String Used for tooltips
Kind Integer wxItemKind.NORMAL May be wxItemKind.NORMAL for a normal button (default), wxItemKind.CHECK for a checkable tool (such tool stays pressed after it had been toggled) or wxItemKind.RADIO for a checkable tool which makes part of a radio group of tools each of which is automatically unchecked whenever another button in the group is checked.
addTool(Id, 
        Label, 
        Bitmap1, 
        Bitmap2, 
        Kind = wxItemKind.NORMAL, 
        ShortHelp = "", 
        LongHelp = "")
 
Name Type Default Description
Id Integer An integer that may be used to identify this tool
Label String
Bitmap1 wxBitmap The primary tool bitmap for toggle and button tools.
Bitmap2 wxBitmap The second bitmap specifies the on-state bitmap for a toggle tool
Kind Integer wxItemKind.NORMAL May be wxItemKind.NORMAL for a normal button (default), wxItemKind.CHECK for a checkable tool (such tool stays pressed after it had been toggled) or wxItemKind.RADIO for a checkable tool which makes part of a radio group of tools each of which is automatically unchecked whenever another button in the group is checked.
ShortHelp String Used for tooltips
LongHelp String String shown in the statusbar.

Adds a tool to the toolbar.

create

create(Parent, 
       Id, 
       Position = wxDefaultPosition, 
       Size, 
       Style = wxToolBar.HORIZONTAL | wxToolBar.NO_BORDER) : Boolean
 
Name Type Default Description
Parent wxWindow The parent of wxToolBar.
Id Integer An window identifier. Use -1 when you don't need it.
Position wxPoint wxDefaultPosition The position of the ToolBar control on the given parent.
Size wxSize The size of the ToolBar control.
Style Integer wxToolBar.HORIZONTAL | wxToolBar.NO_BORDER The wxToolBar style.

Constructs a new wxToolBar object.

deleteTool

deleteTool(Id) : Boolean
 
Name Type Default Description
Id Integer

Deletes the tool with the given id.

deleteToolByPos

deleteToolByPos(Pos) : Boolean
 
Name Type Default Description
Pos Integer

Deletes the tool on the given position.

enableTool

enableTool(Id, 
           Enable) : Boolean
 
Name Type Default Description
Id Integer The tool identifier
Enable Boolean Enable/disable the tool

Enables/disables the tool with the given id.

findControl

findControl(Id) : wxControl
 
Name Type Default Description
Id Integer The tool identifier

Returns the control identified by Id or null when not found.

getToolEnabled

getToolEnabled(Id) : Boolean
 
Name Type Default Description
Id Integer The tool identifier

Returns true when the tool with the given id is enabled. See enableTool

getToolLongHelp

getToolLongHelp(Id) : String
 
Name Type Default Description
Id Integer The tool identifier

Returns the long help from the tool with the given id.

getToolShortHelp

getToolShortHelp(Id) : String
 
Name Type Default Description
Id Integer The tool identifier

Returns the short help from the tool with the given id.

getToolState

getToolState(Id)
 
Name Type Default Description
Id Integer The tool identifier

Returns true when the tool with the given id is toggled on.

insertControl

insertControl(Pos, 
              Control)
 
Name Type Default Description
Pos Integer
Control wxControl

Inserts the control into the toolbar at the given position. You must call realize for the change to take place.

insertSeparator

insertSeparator(Pos)
 
Name Type Default Description
Pos Integer

Inserts a separator into the toolbar at the given position. You must call realize for the change to take place.

insertTool

insertTool(Pos, 
           Id, 
           Label, 
           Bitmap1, 
           Bitmap2, 
           Toogle = false, 
           ShortHelp = "", 
           LongHelp = "") : wxToolBarTool
 
Name Type Default Description
Pos Integer
Id Integer An integer that may be used to identify this tool
Label String
Bitmap1 wxBitmap The primary tool bitmap for toggle and button tools.
Bitmap2 wxBitmap The second bitmap specifies the on-state bitmap for a toggle tool
Toogle Boolean false Is the tool a toggle tool?
ShortHelp String Used for tooltips
LongHelp String String shown in the statusbar.

Inserts the tool to the toolbar at the given position.

realize

realize() : Boolean
 

Call this method after you have added tools.

setToolLongHelp

setToolLongHelp(Id, 
                Help)
 
Name Type Default Description
Id Integer The tool identifier
Help String

Sets the long help from the tool with the given id.

setToolShortHelp

setToolShortHelp(Id, 
                 Help)
 
Name Type Default Description
Id Integer The tool identifier
Help String

Sets the short help for the tool with the given id. The short help will be used to show a tooltip.

toggleTool

toggleTool(Id, 
           Toggle)
 
Name Type Default Description
Id Integer The tool identifier
Toggle Boolean

Toggles a tool on or off. See getToolState.




Design downloaded from Zeroweb.org: Free website templates, layouts, and tools.