1tk::mac(n)                   Tk Built-In Commands                   tk::mac(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       tk::mac - Access Mac-Specific Functionality on OS X from Tk
9

SYNOPSIS

11       ::tk::mac::ShowPreferences
12       ::tk::mac::OpenApplication
13       ::tk::mac::ReopenApplication
14       ::tk::mac::OpenDocument file...
15       ::tk::mac::PrintDocument file...
16       ::tk::mac::Quit
17       ::tk::mac::OnHide
18       ::tk::mac::OnShow
19       ::tk::mac::ShowHelp
20
21       ::tk::mac::standardAboutPanel
22
23       ::tk::mac::useCompatibilityMetrics boolean
24       ::tk::mac::CGAntialiasLimit limit
25       ::tk::mac::antialiasedtext number
26       ::tk::mac::useThemedToplevel boolean
27
28       ::tk::mac::iconBitmap name width height -kind value
29______________________________________________________________________________
30

EVENT HANDLER CALLBACKS

32       The  Aqua/Mac  OS  X  application environment defines a number of addi‐
33       tional events that applications should respond  to.  These  events  are
34       mapped  by  Tk  to calls to commands in the ::tk::mac namespace; unless
35       otherwise noted, if the command is absent, no action will be taken.
36
37       ::tk::mac::ShowPreferences
38              The default Apple Event handler for kAEShowPreferences,  “pref”.
39              The  application  menu  “Preferences”  menu item is only enabled
40              when this proc is defined. Typically this  command  is  used  to
41              wrap a specific own preferences command, which pops up a prefer‐
42              ences window. Something like:
43
44                     proc ::tk::mac::ShowPreferences {} {
45                         setPref
46                     }
47
48       ::tk::mac::OpenApplication
49              If a proc of this name is defined, this proc fill fire when your
50              application  is  intially  opened. It is the default Apple Event
51              handler for kAEOpenApplication, “oapp”.
52
53       ::tk::mac::ReopenApplication
54              If a proc of this name is defined it is the default Apple  Event
55              handler  for  kAEReopenApplication, “rapp”, the Apple Event sent
56              when your application is opened when it is already running (e.g.
57              by  clicking its icon in the Dock). Here is a sample that raises
58              a minimized window when the Dock icon is clicked:
59
60                     proc ::tk::mac::ReopenApplication {} {
61                         if {[wm state .] eq "withdrawn"} {
62                             wm state . normal
63                         } else {
64                             wm deiconify .
65                         }
66                         raise .
67                     }
68
69       ::tk::mac::OpenDocument file...
70              If a proc of this name is defined it is the default Apple  Event
71              handler  for kAEOpenDocuments, “odoc”, the Apple Event sent when
72              your application is asked to open one or more  documents  (e.g.,
73              by  drag  & drop onto the app or by opening a document of a type
74              associated to the app). The proc should take as arguments  paths
75              to the files to be opened, like so:
76
77                     proc ::tk::mac::OpenDocument {args} {
78                         foreach f $args {my_open_document $f}
79                     }
80
81       ::tk::mac::PrintDocument file...
82              If  a proc of this name is defined it is the default Apple Event
83              handler for kAEPrintDocuments, “pdoc”, the Apple Event sent when
84              your  application is asked to print one or more documents (e.g.,
85              via the Print menu item in the Finder).  It works the  same  way
86              as tk::mac::OpenDocument in terms of arguments.
87
88       ::tk::mac::Quit
89              If  a proc of this name is defined it is the default Apple Event
90              handler for kAEQuitApplication, “quit”,  the  Apple  Event  sent
91              when  your  application  is  asked to be quit, e.g. via the quit
92              menu item in the application menu, the quit  menu  item  in  the
93              Dock  menu,  or during a logout/restart/shutdown etc. If this is
94              not defined, exit is called instead.
95
96       ::tk::mac::OnHide
97              If defined, this is called  when  your  application  receives  a
98              kEventAppHidden event, e.g. via the hide menu item in the appli‐
99              cation or Dock menus.
100
101       ::tk::mac::OnShow
102              If defined, this is called  when  your  application  receives  a
103              kEventAppShown  event,  e.g.  via  the show all menu item in the
104              application menu, or by clicking  the  Dock  icon  of  a  hidden
105              application.
106
107       ::tk::mac::ShowHelp
108              Customizes behavior of Apple Help menu; if this procedure is not
109              defined, the platform-specific standard Help menu item  “YourApp
110              Help” performs the default Cocoa action of showing the Help Book
111              configured in the application's  Info.plist  (or  displaying  an
112              alert if no Help Book is set).
113

ADDITIONAL DIALOGS

115       The  Aqua/Mac  OS X defines additional dialogs that applications should
116       support.
117
118       ::tk::mac::standardAboutPanel
119              Brings the standard Cocoa about panel to the front, with all its
120              information  filled in from your application bundle files (stan‐
121              dard about panel with no options specified). See Apple  Technote
122              TN2179  and  the AppKit documentation for -[NSApplication order‐
123              FrontStandardAboutPanelWithOptions:]   for   details   on    the
124              Info.plist keys and app bundle files used by the about panel.
125

SYSTEM CONFIGURATION

127       There are a number of additional global configuration options that con‐
128       trol the details of how Tk renders by default.
129
130       ::tk::mac::useCompatibilityMetrics boolean
131              Preserves compatibility with older Tk/Aqua metrics; set to false
132              for more native spacing.
133
134       ::tk::mac::CGAntialiasLimit limit
135              Sets  the  antialiasing  limit;  lines thinner that limit pixels
136              will not be antialiased. Integer, set to 0  by  default,  making
137              all lines be antialiased.
138
139       ::tk::mac::antialiasedtext number
140              Sets  anti-aliased  text.   Controls text antialiasing, possible
141              values for number are -1 (default, use system default  for  text
142              AA), 0 (no text AA), 1 (use text AA).
143
144       ::tk::mac::useThemedToplevel boolean
145              Sets toplevel windows to draw with the modern grayish/ pinstripe
146              Mac background. Equivalent  to  configuring  the  toplevel  with
147-background   systemWindowHeaderBackground”,   or  to  using  a
148              ttk::frame.
149

SUPPORT COMMANDS

151       ::tk::mac::iconBitmap name width height -kind value
152              Renders native icons and bitmaps in Tk  applications  (including
153              any  image  file  readable  by NSImage). A native bitmap name is
154              interpreted as follows (in order):
155
156              ·  predefined builtin 32x32 icon name (stop, caution,  document,
157                 etc.)
158
159              ·  name, as defined by tk::mac::iconBitmap
160
161              ·  NSImage named image name
162
163              ·  NSImage url string
164
165              ·  4-char OSType of IconServices icon
166
167              The width and height arguments to tk::mac::iconBitmap define the
168              dimensions of the image to create, and -kind must be one of:
169
170              -file  icon of file at given path
171
172              -fileType
173                     icon of given file type
174
175              -osType
176                     icon of given 4-char OSType file type
177
178              -systemType
179                     icon for given IconServices 4-char OSType
180
181              -namedImage
182                     named NSImage for given name
183
184              -imageFile
185                     image at given path
186

SEE ALSO

188       bind(n), wm(n)
189

KEYWORDS

191       about dialog, antialiasing, Apple event, icon, NSImage
192
193
194
195Tk                                    8.6                           tk::mac(n)
Impressum