Code by Kevin has developed several open-source Tcl/Tk packages to improve the Mac look-and-feel of our software. All packages are developed under Tcl/Tk's BSD-style license (http://www.tcl.tk/software/tcltk/license.html). In hopes that other developers might make use of these packages, they are documented and available for download below. All packages require Tk 8.5.
The Aquahig package implements some Mac OS X-specific configurations to selected Tk megawidgets to make them better fit in visually with Mac interface conventions, similar to iTunes and other Mac applications. Currently supported widgets are the BWidgets Tree, the BWidgets ListBox, and Tablelist.
The aquahig package is invoked by calling package require aquahig. It implements Mac styling for widgets in the form of arrays:
aquahig::treeopts: These options add a Mac-style "disclosure triangle" to the BWidget Tree, remove the lines for tree nodes (which is more charactertistic of Windows), and add a light blue background and a blue highlight foreground (similar to iTunes). They also specify the correct font size and spacing.
aquahig::listopts: These options add a light blue background and a blue highlight foreground (similar to iTunes) to the BWidget ListBox. They also specify the correct font size and spacing.
aquahig::tableopts: These options add a light blue stripe, a blue highlight foreground color, and vertical rules (similar to iTunes) to TableList.
Usage of the package would look something like this:
foreach {key value} [array get aquahig::treeopts] {
$w configure -$key $value
}
Note: the aquahig package depends on the TkImg or TkPNG packages, as the Mac-style disclosure triangles are pngs. To use another image format, such as .gif, you will need to edit the source code accordingly.
The macgrowl package is a high-level Tcl wrapper for the Growl notification system on OS X (http://growl.info). It interfaces with Growl via AppleScript, and provides hooks to post Growl notifications. (Growl also comes with an older Tcl binding that requires building from source, but it is unsupported and will not compile against recent versions of Growl.)
The macgrowl package is called via package require macgrowl, and defines the following commands:
macgrowl::macgrowl {app title message}: This command posts a Growl notification, and takes an application name (for display of the application's icon), message title, and message text as arguments.
macgrowl::demo: This command demonstrates the macgrowl package.
Note: Growl is not installed on Mac OS X by default, so it is a good idea to check for a Growl installation before calling the macgrowl package. This Tcl procedure will check to see if Growl is running:
#check to see if growl is running
proc checkGrowl {} {
global growlrunning
set growlrunning [exec osascript -e {
tell application "System Events"
set isRunning to (count of (every process whose name is "GrowlHelperApp")) > 0
end tell
}]
return growlrunning
}
If the $growlrunning variable is "true," then Growl is running.
The macnotify package is designed to bounce Mac applications on the Dock when the application is not frontmost on the screen and it displays an alert (in the form of a tk_messageBox). The package works via a combination of Tcl and AppleScript. It provides functionality similar to Daniel Steffen's tclCarbonNotification package, but is a script-level package and thus does not require compilation.
The macnotify package is called via package require macnotify, and defines the following command:
macnotify::alert {titletext messagetext detailtext icontype attachwindow}: This command, which displays the messagebox and bounces the application icon on the Dock if necessary, takes a messagebox title, the messagebox text, the messagebox details, the messagebox icon type (info, warning, etc.), and the parent window (so it can be displayed as a sheet) as arguments.
The windowlist package implements a "window" menu, which is recommended by Apple's interface guidelines. The package tracks all toplevel windows, minimizes and raises windows, and displays all toplevel windows in an application.
The windowlist package is called via package require windowlist, and defines the following command:
windowlist::windowMenu {mainmenu}: This command implements a "window" menu, and takes the name of the application's main menu as an argument. The windowmenu includes commands to minimize the frontmost window, bring all windows to the front, and raise a selected window. It also implements keyboard navigation for windows.
Text ©2010 WordTech Communications, LLC. See Credits for other acknowledgments.

Products
User Forum
Blog
Open Source
Contact
Sales Policies
Discounts
Credits
About