Copyright © 2008, 2009 Arndt Roger Schneider
The RTL based option creator is used
to instantiate the template zoolbar with a
Tk Window. The used creator window must have a
-class
property.
Acceptable Tk Windows are: toplevel for floating windows, and frame for embedded windows.
See the options manual entry for details on the standard options.
»useToken« activates the glyph vector graphics system implemented in the toolbar. If »useToken« is set to »1« (true), then the item property »iconFont« is evaluated and the provided image substituted through the glyph given by the property: »token«.
The item properties »bgImage« and »image« are recessive to »token«, whenever »useToken« is set.
»useGrid« tells the toolbar to place each item aligned on a grid defined by »gridSize«.
»gridSize« expects a distance denoting the size of a cell. An item may occupy one or more of such cells.
»gridSize« is used in a fuzzy-like way. If the dimensions of neighboring items are small in compared to the actual item, then the actual item may share some space from its neighbors. The same applies if the actual item is small compare to the neighboring items –it does yield some space to them.
»showImage«, a boolean property, tells the toolbar to display images.
»image« may be »fgImage«, »image« or »token« and »iconFont« or »vector«.
»showText«, a boolean property, tells the toolbar to display the »label« of all its items.
This option must have a proper boolean value, which specifies whether or not the window should include a tear-off entry at the left. The default windows bindings arrange for the window to be torn off when the tear-off entry is invoked.
If this option has a non-empty value, then it specifies a Tcl command to invoke whenever the window is torn off.
The conventional Runtime Library template mechanism is used for the »tearoff« functionality. That is A torn-off toolbar is converted into a floating window and replaces the original –embedded– window.
Under Construction.
Toolbar items may be visible or invisible. This setting is controlled via the »show« property. Suppose there are four items inside the toolbar named »a«, »b«, »c« and »d« in this situation all items will be initial visible –right after they were added to the toolbar, unless »show« was specified prior to the add commands.
Example A.18. Implicit Visible Items
# Create the toolbar without specifying # show makes all added items visible. .toolbar add command a … .toolbar add command b … .toolbar add command c … .toolbar add command d …
Example A.19. Explicit Visible Items
# Example hide d – and add variable space (~) .toolbar configure -show {a b ~ c}
The »title« property is only used for a free-floating toolbar. The text property »title« is used as the caption for the created toplevel window.
A boolean property. Either 0 or 1. Default is 0 (false/off). Tells the toolbar to break the items into multiple lines.
In addition, line break can be controlled by defining »columnbreak« for an item.
»useMenu« expects a boolean value. if »useMenu« is set to »1« (true) then a context menu will presented after a <<Context>> (a right-button-click) occured. Do also use »customizeCommand« together with »useMenu«.
The »hideCommand« is used inside the toolbar context menu. The conventional response to this command is to invoke the »Hide Toolbar« menu entry in the »View« menu.
Example A.20. Hide Toolbar
# The application Toolbar: goolbar .toolbar -hidecommand { .menubar.view invoke ?index of entry? } # The Application Menubar: menu .menubar . configure -menu .menubar # The Menubar entry »View«: .menubar add cascade \ -label "View" \ -menu .menubar.view # The »Hide Toolbar« command inside the # »View« menu: Record the index of this # command: .menubar.view add command \ -label "Hide Toolbar" -command ...
A toolbar customization function.
The »customizeCommand« will be accessible from the toolbar context menu.
Use the »customizeCommand« in order to invoke the Gooleditor for this toolbar.
Example A.21. Calling a Gooleditor
goolbar .toolbar -customizeCommand \ [list customizeToolbar .toolbar] proc customizeToolbar toolbar { if ![winfo exists $toolbar] return # An embedded dialog set fmt myicons # A different embedded dialog for glyphs: if [$toolbar cget -useToken] { set fmt mytbicons } # Display the toolbar editor inside # the parent window. gooleditor [winfo parent $toolbar].custom \ -goolbar $toolbar -custom $fmt }
The »vectorSize« is reported to the canvas graphics based vectors.
In the future: Vectors, glyphs and images may become fully interactively resize-able –with a scroll-wheel. This feature requires that all vector graphics originate from TkPath.
It is OK to ignore the size parameter, when creating a vector.
Always use resolution independent values like »24p« –24 points. 24p is the »vectorSize« default value.
The Zoolbar already supports »vectorSize« for images.
A Window created through the zoolbar command exposes various functions. Using these functions has the following general form:
pathName option ?arg arg ...?
PathName is the same as the window path name. Option and the args determine the exact behavior of the command. The following commands are possible for this window:
Returns the current value of the configuration option given by option. Option may have any of the values accepted by the zoolbar command.
Query or modify the configuration options of the window. If no option is specified, returns a list describing all of the available options for pathName (see Tk_ConfigureInfo for information on the format of this list). If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). If one or more option-value pairs are specified, then the command modifies the given window option(s) to have the given value(s); in this case the command returns an empty string. Option may have any of the values accepted by the zoolbar command.
Removes the given »item« from the Zoolbar.
Written : 2007, Roger
Related to »pendingRedraw«. Internal used, too. The suggested Mbutton is the menubutton to the right side, which provides access to the truncatedd Zoolbar items –listed inside a menu.
Written : 2007, Roger
Creates the context menu for the Zoolbar. The provided »menu« is emptied before new menu entries are being added to it.
Written : 2007, Roger
Queries the item »name« for its property »attr«.
Written : 06/10/2008, Roger Example : .zoolbar itemcget help -vector
»add« is the item creation function inside a Zoolbar. The general mechanism is as-close-as-possible to its model: menu.
However, each item added to a Zoolbar must be »name«d.
Written : 2007, Roger
Internal used. »pendingRedraw« delays the redraw operations –using after idle. »widht« and »height« are the new dimension for the Zoolbar.
Written : 2007, Roger
Displays all truncated items inside of a »menu« to the right side of the Zoolbar.
Written : 2007, Roger
Internal used. Adds »item« to the member list.
Written : 2007, Roger
Converts a Zoolbar into a floating window.
Written : 2007, Roger
Changes the state of item »index« into active. The provided »color« is used as the image foreground color, whenever the image is a »bitmap«.
Written : 2007, Roger
Reintegrates a former »gridded« Zoolbar at the previous place. The actual zoolbar must be a floating window.
Written : 2007, Roger
Either queries or set certain properties for the item identified with »name«.
Written : 2007, Roger
decide position of item in toolbar (related to toplevel).
See also »griddedSize«.
Written : 2007, Roger
Retrieve the »type« of the item with »name«.
Written : 2007, Roger
Displays the context menu (see customizeMenu) on-screen at point: »x, y«. »widget« is unused.
Written : 2007, Roger
Creates »gstripes::stripes« compliant stripes. Zinc is not compatible with the convontional »gstripes« design.
Written : 2007, Roger
Internal used. Identifies the item located at point »x, y« and executes »execute«, if the point lies near or inside the bounding box of the item idenitified with »index«.
Written : 2007, Roger
»redraw« does all the drawings inside the Zoolbar. For a more detailed discussion see the Goolbar redraw entry.
Zoolbar is a Goolbar ported to Zinc.
Written : 2007, Roger
Calculate the item position in times of grid The grid is meant to give the toolbar –and multiple toolbars… an even look since the items aren’t dependent on there dimensions placed.
Written : 2007, Roger