Win32::GUI::Toolbar - Create and manipulate toolbar controls
Common methods apply to most windows, controls and resources.
Creates a new Toolbar object; can also be called as PARENT->AddToolbar(%OPTIONS).
Class specific %OPTIONS are:
-adjustable => 0/1 -altdrag => 0/1 -flat => 0/1 -list => 0/1 -transparent => 0/1 -imagelist => IMAGELIST -multiline => 0/1 The control can have more than one line -nodivider => 0/1 -tooltip => Win32::GUI::Tooltip object
See also the common options.
Adds a buttons-bitmap to the toolbar. BITMAP should be a handle to the bitmap containing button images, and NUMBUTTONS should be a number specifying the number of button images in the bitmap.
Note that this function will CROAK an error if the toolbar already has an imagelist assigned to it and will not perform the bitmap assignment, since you should not use AddBitmap on a toolbar that has an imagelist assigned.
AddButtons(NUMBER, (BITMAP, COMMAND, STATE, STYLE, STRING) ...)
Adds buttons to the toolbar. Note that BITMAP, COMMAND, STATE, STYLE and
causes the toolbar to be resized
returns the number of buttons in the toolbar
Changes the bitmap for a specific button. BITMAP should be a Win32::GUI::Bitmap object. Will fail if toolbar currently has an imagelist assigned. Will return nonzero on success, zero on failure.
Checks or unchecks a given button on the toolbar. BUTTON is the index of the button to check, CHECKED is 0 to uncheck the button, 1 to check the button. When a button is checked, it is displayed in the pressed state.
Retrieves the zero-based index for the button associated with the specified command identifier.
Displays the Customize Toolbar dialog box.
Removes a button from the toolbar. BUTTON is the index of the button to remove. Returns nonzero if successful, zero on failure.
Enables or disables the specified button in a toolbar.
Retrieves the anchor highlight setting for a toolbar.
Retrieves the index of the bitmap associated with the specified command identifier.
Retrieves the flags for the current bitmap. If this value is zero, the toolbar is using a small bitmap. If the TBBF_LARGE flag is set, the toolbar is using a large bitmap.
Retrieves information about the specified button in a toolbar. Return an array (BITMAP, COMMAND, STATE, STYLE, STRING).
Retrieves information about the button associated with the specified command identifier.
Retrieves the current width and height of toolbar buttons, in pixels.
Retrieves the text of a button in a toolbar.
Retrieves Toolbar color scheme hash information.
-clrBtnHighlight => COLOR the highlight color of the buttons. -clrBtnShadow => COLOR the shadow color of the buttons.
Returns the handle to the disabled imagelist currently used by the toolbar, or 0 if no disabled imagelist is currently assigned. Note that this does not return a blessed imagelist object, just a handle.
Returns the handle to the "hot" (rollover) imagelist currently used by the toolbar, or 0 if no hot imagelist is currently assigned. Note that this does not return a blessed imagelist object, just a handle.
Retrieves the index of the hot item in a toolbar.
Returns the handle to the imagelist currently used by the toolbar, or 0 if no imagelist is currently assigned. Note that this does not return a blessed imagelist object, just a handle.
Retrieves the current insertion mark for the toolbar. Return an array (BUTTON,FLAGS).
Retrieves the color used to draw the insertion mark for the toolbar.
Retrieves the bounding rectangle of a button in a toolbar.
returns the total size of all the visible buttons and separators in the toolbar (or undef on errors)
Retrieves the padding for a toolbar control.
Retrieves the bounding rectangle for a specified toolbar button.
Retrieves the number of rows of buttons in a toolbar with the TBSTYLE_WRAPABLE style.
Retrieves information about the state of the specified button in a toolbar, such as whether it is enabled, pressed, or checked.
Retrieves the string from the toolbar's string pool identified by the zero based INDEX
Gets the current style for the toolbar.
Retrieves the maximum number of text rows that can be displayed on a toolbar button.
Retrieves the handle to the tooltip control, if any, associated with the toolbar.
Retrieves the UNICODE character format flag for the control.
Hides or shows the specified button in a toolbar.
Determines where a point lies in a toolbar control.
Sets or clears the indeterminate state of the specified button in a toolbar.
InsertButton(BUTTON, BITMAP, COMMAND, STATE, STYLE, ISTRING)
Insert a new button.
Retrieves the insertion mark information for a point in a toolbar. If (X,Y) point is an insertion mark, return an array (BUTTON,FLAGS).
Determines whether the specified button in a toolbar is checked.
Determines whether the specified button in a toolbar is enabled.
Determines whether the specified button in a toolbar is hidden.
Determines whether the specified button in a toolbar is highlighted.
Determines whether the specified button in a toolbar is indeterminate.
Determines whether the specified button in a toolbar is pressed.
Loads bitmaps into a toolbar control's image list.
IDBITMAP when HINSTANCE == HINST_COMMCTRL,
IDB_HIST_LARGE_COLOR = Explorer bitmaps in large size. IDB_HIST_SMALL_COLOR = Explorer bitmaps in small size. IDB_STD_LARGE_COLOR = Standard bitmaps in large size. IDB_STD_SMALL_COLOR = Standard bitmaps in small size. IDB_VIEW_LARGE_COLOR = View bitmaps in large size. IDB_VIEW_SMALL_COLOR = View bitmaps in small size.
Maps an accelerator character to a toolbar button.
Sets the highlight state of a given button in a toolbar control.
Moves the button specified by BUTTON to the new position TARGET. Returns non-zero if successful, or zero on failure.
gets or sets the padding for the toolbar; if no value is passed, returns a list containing the current x and y padding value, in pixels.
Presses or releases the specified button in a toolbar.
SaveRestore(FLAG, SUBKEY, VALUENAME)
Saves or restores the state of the toolbar in registry (Use HKEY_CURRENT_USER).
Save or restore flag. If this parameter is TRUE, the information is saved. If it is FALSE, it is restored.
Subkey registry name.
Value registry name.
Determines whether the specified button in a toolbar is pressed.
Sets the size of the bitmapped images to be added to a toolbar. The size can be set only before adding any bitmaps to the toolbar. If an application does not explicitly set the bitmap size, the size defaults to 16 by 15 pixels.
Sets the information for the button associated with the specified command identifier.
-command => ID Command identifier of the button. -image => INDEX Image index of the button -state => STATE State flags of the button. You can also use : -checked => 0/1 -ellipses => 0/1 -enabled => 0/1 -hidden => 0/1 -grayed => 0/1 -marked => 0/1 -pressed => 0/1 -wrapped => 0/1 -style => STYLE Style flags of the button. You can also use : -autosize => 0/1 -check => 0/1 -checkgroup => 0/1 -dropdown => 0/1 -group => 0/1 -noprefix => 0/1 -separator => 0/1 -width => WIDTH Width of the button, in pixels. -text => STRING Text of the button.
Sets the size of the buttons to be added to a toolbar. The size can be set only before adding any bitmaps to the toolbar. If an application does not explicitly set the buttons size, the size defaults to 24 by 22 pixels.
Sets the state for the specified toolbar button. STATE should be one or more state flags bitwise-ORed together.
State flag constants are as follows:
TBSTATE_CHECKED The button has the TBSTYLE_CHECK style and is being clicked. TBSTATE_ELLIPSES The button's text is cut off and an ellipsis is displayed. TBSTATE_ENABLED The button accepts user input. A button that doesn't have this state is grayed. TBSTATE_HIDDEN The button is not visible and cannot receive user input. TBSTATE_INDETERMINATE The button is grayed. TBSTATE_MARKED The button is marked. The interpretation of a marked item is dependent upon the application. TBSTATE_PRESSED The button is being clicked. TBSTATE_WRAP The button is followed by a line break. The button must also have the TBSTATE_ENABLED state.
Sets the minimum and maximum button widths in the toolbar control.
Sets the command identifier of a toolbar button.
Sets Toolbar color scheme.
-clrBtnHighlight => COLOR. the highlight color of the buttons. -clrBtnShadow => COLOR. the shadow color of the buttons.
Sets the image list for disabled button images. Returns a handle to the previous disabled imagelist associated with the toolbar.
Sets the text drawing flags for the toolbar.
Sets the extended style for the toolbar. STYLE should be one or more style flags bitwise-ORed together.
Extended style flag constants are as follows:
TBSTYLE_EX_DRAWDDARROWS This style allows buttons to have a separate dropdown arrow. Buttons that have the BTNS_DROPDOWN style will be drawn with a drop-down arrow in a separate section, to the right of the button. If the arrow is clicked, only the arrow portion of the button will depress, and the toolbar control will send a TBN_DROPDOWN notification to prompt the application to display the dropdown menu. If the main part of the button is clicked, the toolbar control sends a WM_COMMAND message with the button's ID. The application normally responds by launching the first command on the menu. There are many situations where you may want to have only some of the dropdown buttons on a toolbar with separated arrows. To do so, set the TBSTYLE_EX_DRAWDDARROWS extended style. Give those buttons that will not have separated arrows the BTNS_WHOLEDROPDOWN style. Buttons with this style will have an arrow displayed next to the image. However, the arrow will not be separate and when any part of the button is clicked, the toolbar control will send a TBN_DROPDOWN notification. To prevent repainting problems, this style should be set before the toolbar control becomes visible. TBSTYLE_EX_HIDECLIPPEDBUTTONS This style hides partially clipped buttons. The most common use of this style is for toolbars that are part of a rebar control. If an adjacent band covers part of a button, the button will not be displayed. However, if the rebar band has the RBBS_USECHEVRON style, the button will be displayed on the chevron's dropdown menu. TBSTYLE_EX_MIXEDBUTTONS This style allows you to set text for all buttons, but only display it for those buttons with the BTNS_SHOWTEXT button style. The TBSTYLE_LIST style must also be set. Normally, when a button does not display text, your application must handle TBN_GETINFOTIP to display a ToolTip. With the TBSTYLE_EX_MIXEDBUTTONS extended style, text that is set but not displayed on a button will automatically be used as the button's ToolTip text. Your application only needs to handle TBN_GETINFOTIP if it needs more flexibility in specifying the ToolTip text.
Sets the image list for "hot" (rollover) button images. Returns a handle to the previous hot image list associated with the toolbar.
Toolbars must have the TBSTYLE_FLAT or TBSTYLE_LIST style to have hot items.
see also Win32::GUI::Toolbar::SetStyle
Sets the hot item in a toolbar. This message is ignored for toolbar controls that do not have the TBSTYLE_FLAT style.
Sets the image list for regular button images. Returns a handle to the previous image list associated with the toolbar. Note that this will CROAK an error if you have previously called AddBitmap() on the toolbar - you cannot use SetImageList and AddBitmap on the same toolbar.
sets the indentation value for the toolbar
Sets the current insertion mark for the toolbar.
sets the indentation value for the toolbar
Sets the maximum number of text rows displayed on a toolbar button.
Sets the padding for a toolbar control.
Sets the window to which the toolbar control sends notification messages.
Sets the number of rows of buttons in a toolbar. Flag that indicates whether to create more rows than requested when the system cannot create the number of rows specified. Return the bounding rectangle of the toolbar after the rows are set.
Sets the style for the toolbar. STYLE should be one or more style flags bitwise-ORed together.
Style flag constants are as follows:
TBSTYLE_ALTDRAG Allows users to change a toolbar button's position by dragging it while holding down the ALT key. If this style is not specified, the user must hold down the SHIFT key while dragging a button. Note that the CCS_ADJUSTABLE style must be specified to enable toolbar buttons to be dragged. TBSTYLE_CUSTOMERASE Generates NM_CUSTOMDRAW notification messages when the toolbar processes WM_ERASEBKGND messages. TBSTYLE_FLAT Creates a flat toolbar. In a flat toolbar, both the toolbar and the buttons are transparent and hot-tracking is enabled. Button text appears under button bitmaps. To prevent repainting problems, this style should be set before the toolbar control becomes visible. TBSTYLE_LIST Creates a flat toolbar with button text to the right of the bitmap. Otherwise, this style is identical to TBSTYLE_FLAT. To prevent repainting problems, this style should be set before the toolbar control becomes visible. TBSTYLE_REGISTERDROP Generates TBN_GETOBJECT notification messages to request drop target objects when the cursor passes over toolbar buttons. TBSTYLE_TOOLTIPS Creates a ToolTip control that an application can use to display descriptive text for the buttons in the toolbar. TBSTYLE_TRANSPARENT Creates a transparent toolbar. In a transparent toolbar, the toolbar is transparent but the buttons are not. Button text appears under button bitmaps. To prevent repainting problems, this style should be set before the toolbar control becomes visible. TBSTYLE_WRAPABLE Creates a toolbar that can have multiple lines of buttons. Toolbar buttons can "wrap" to the next line when the toolbar becomes too narrow to include all buttons on the same line. When the toolbar is wrapped, the break will occur on either the rightmost separator or the rightmost button if there are no separators on the bar. This style must be set to display a vertical toolbar control when the toolbar is part of a vertical rebar control.
Sets the tooltip object for the toolbar. TOOLTIP should be a Win32::GUI::Tooltip object. Note that this should be called before adding buttons, otherwise tooltips will not be registered. You can set a tooltips object for the toolbar on creation with the -tooltip option.
Sets the UNICODE character format flag for the control.
Common events apply to most windows and controls.
ButtonClick(INDEX,[DROPDOWN = 1])
Sent when the user presses a button of the Toolbar the INDEX argument identifies the zero-based index of the pressed button. If the button clicked should expand a dropdown menu, then there is a second argument that is set to 1.
Documentation for Win32::GUI v1.12 created 03 Jun 2015
This document is autogenerated by the build process. Edits made here will be lost. Edit docs/per_package.tpl instead.
For further support join the users mailing list from the website at http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users. There is a searchable list archive at http://sourceforge.net/p/perl-win32-gui/mailman/perl-win32-gui-users/.
Copyright (c) 1997..2015 Aldo Calpini. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.