Copyright © 2008, 2009 Arndt Roger Schneider
The Goolbar design is inspired by the menu interface. This guarantees an easy implementation –close to every application features a menu. The Goolbar has commands, checkbuttons, radiobuttons, separators and one variable space. There is one major difference to Tk menus: The goolbar items have explicit names –specified during instantiation.
Toolbar items may be visible or invisible. Visibility is controlled by the Goolbar »-show« property. Suppose there are four items inside the Goolbar named »a«, »b«, »c« and »d«; in this situation all items will be initial visible. Right after they were added to the Goolbar, unless »-show« was specified prior to the add commands.
A caption is specific for an item and defined through the item´s »-label« property.
Glyphs are specified through the »token« and »iconFont« item properties. The token references the glyph in the defined icon font, multiple glyphs are allowed.
Vector procedures have to follow a certain signature to be used as such from within a Goolbar.
Signature details
The first parameter »canvas« is the drawing window inside the Goolbar.
The required tags for the new–to be created– vector item.
The provided »tags« are used to manipulate and identify the item, to which the vector belongs.
When using groups under TkPath 0.3, only assign these »tags« to the main group of the created vector and not to its elements.
The coordinates where the new vector icon is to be created. The used anchor is »s« (south).
The dimensions of the new vector icon.
The size value originates from the »vectorsize« Goolbar property.
Use the following formulas to convert real canvas coordinates into vector size:
Example 2.6. Lisp Code to calculate Vector Icons
;; Y-Position (* (/ (- bottom y) (- bottom top)) 1.25) ;; X-Position (/ (- x (* 0.5 (+ right left))) (- right left))
Bottom, top, left and right in Example 2.6, “Lisp Code to calculate Vector Icons” are either the outer coordinates or the
bounding box around all elements inside this vector.
The vector formula is Lisp-Code.
Using TkPath 0.2 transformation inside a vector is a rather bad idea. Specifically avoid rotations. Best practice: first design the vector, then convert rotated items to path.
With TkPath 0.3 use a basic group without transformations, transformations are then usable for the items inside of it.