Tk-Components

Artifact [06450760f6]
Login

Artifact 06450760f64478c119ba4387f49f05c9e5b1ae13:


NAME
mactoolbar - Native Mac toolbar in Tk windows

SYNPOSIS

package require mactoolbar

mactoolbar::createbutton identifier label tooltip imagepath cmd 

mactoolbar::create window

DESCRIPTION

This package creates a Mac-native toolbar (based on the Cocoa NSToolbar) for use in Tk windows. 

The mactoolbar::createbutton command creates a command button that will be displayed in the toolbar, and takes five arguments: a string identifier for the toolbutton, a label for the toolbutton, a string for the toolbutton's tooltip, a path to an image that will be displayed in the button, and the Tcl command to execute. 

The mactoolbar::create command actually creates the toolbar, and takes a single argument, the window that will display the toolbar. 

LIMITATIONS

The mactoolbar package offers a basic implementation of the NSToolbar library; it displays toolbar buttons, with labels and images, and does not display other Mac-native widgets such as the Cocoa searchfield. It does not allow customization, nor can it display Tk widgets. 

Also, it is important to set the "unifiedTitleAndToolbar" window flag, immediately after creating the toolbar, using the tk::unsupported::MacWindowStyle command; otherwise the internal geometry of Tk's widgets will be distorted. The window flag can be set like so:

tk::unsupported::MacWindowStyle style .f document {unifiedTitleAndToolbar standardDocument}

KEYWORDS

sheet, Mac, Cocoa