Compare commits

...

4 Commits

Author SHA1 Message Date
Steve Dower
42c69189d9 Import Tk 8.6.10 2020-09-24 22:55:34 +01:00
Steve Dower
5ba5cbc9af Imported Tk 8.6.9 2018-12-11 10:05:28 -08:00
Steve Dower
753ac6b037 Merge pull request #5 from csabella/8.6.8-tk
Import Tk 8.6.8
2018-02-23 08:19:42 -08:00
Cheryl Sabella
8e57feeeb9 Import Tk 8.6.8 2018-02-22 14:31:15 -05:00
441 changed files with 34957 additions and 17098 deletions

View File

@@ -1,6 +1,6 @@
A NOTE ON THE CHANGELOG:
Starting in early 2011, Tk source code has been under the management of
fossil, hosted at http://core.tcl.tk/tk/ . Fossil presents a "Timeline"
fossil, hosted at https://core.tcl-lang.org/tk/ . Fossil presents a "Timeline"
view of changes made that is superior in every way to a hand edited log file.
Because of this, many Tk developers are now out of the habit of maintaining
this log file. You may still find useful things in it, but the Timeline is

View File

@@ -5218,7 +5218,7 @@
2000-05-31 Eric Melski <ericm@scriptics.com>
* library/bgerror.tcl: Improved bgerror based on work by Donal
K. Fellows; no longer dependant on tk_dialog; features a
K. Fellows; no longer dependent on tk_dialog; features a
Windows-esque "Details" button, and a customizable extra function
button that allows the user to (for example) save the stack trace
to a file.

41
README
View File

@@ -1,41 +0,0 @@
README: Tk
This is the Tk 8.6.6 source distribution.
http://sourceforge.net/projects/tcl/files/Tcl/
You can get any source release of Tk from the URL above.
1. Introduction
---------------
This directory contains the sources and documentation for Tk, an X11
toolkit implemented with the Tcl scripting language.
For details on features, incompatibilities, and potential problems with
this release, see the Tcl/Tk 8.6 Web page at
http://www.tcl.tk/software/tcltk/8.6.html
or refer to the "changes" file in this directory, which contains a
historical record of all changes to Tk.
Tk is maintained, enhanced, and distributed freely by the Tcl community.
Source code development and tracking of bug reports and feature requests
takes place at:
http://core.tcl.tk/tk/
with the Tcl Developer Xchange at:
http://www.tcl.tk/
Tk is a freely available open source package. You can do virtually
anything you like with it, such as modifying it, redistributing it,
and selling it either in whole or in part. See the file
"license.terms" for complete information.
2. See Tcl README
-----------------
Please see the README file that comes with the associated Tcl release
for more information. There are pointers there to extensive
documentation. In addition, there are additional README files
in the subdirectories of this distribution.

View File

@@ -1,2 +1,37 @@
# cpython-source-deps
Source for packages that the cpython build process depends on
# README: Tk
This is the **Tk 8.6.10** source distribution.
You can get any source release of Tk from [our distribution
site](https://sourceforge.net/projects/tcl/files/Tcl/).
## <a id="intro">1.</a> Introduction
This directory contains the sources and documentation for Tk, a
cross-platform GUI toolkit implemented with the Tcl scripting language.
For details on features, incompatibilities, and potential problems with
this release, see [the Tcl/Tk 8.6 Web page](https://www.tcl.tk/software/tcltk/8.6.html)
or refer to the "changes" file in this directory, which contains a
historical record of all changes to Tk.
Tk is maintained, enhanced, and distributed freely by the Tcl community.
Source code development and tracking of bug reports and feature requests
takes place at [core.tcl-lang.org](https://core.tcl-lang.org/).
Tcl/Tk release and mailing list services are [hosted by
SourceForge](https://sourceforge.net/projects/tcl/)
with the Tcl Developer Xchange hosted at
[www.tcl-lang.org](https://www.tcl-lang.org).
Tk is a freely available open source package. You can do virtually
anything you like with it, such as modifying it, redistributing it,
and selling it either in whole or in part. See the file
`license.terms` for complete information.
## <a id="tcl">2.</a> See Tcl README.md
Please see the README.md file that comes with the associated Tcl release
for more information. There are pointers there to extensive
documentation. In addition, there are additional README files
in the subdirectories of this distribution.

399
changes
View File

@@ -1315,7 +1315,7 @@ ISO Latin-1 character set.
result across the execution of binding scripts. Otherwise if an event
triggers in the middle of some other script (e.g. a destroy event during
window creation, because there was an error in the creation command),
the intepreter's result gets lost.
the interpreter's result gets lost.
2/19/94 (bug fix) Fixed bug in dealing with results of sent command
that could cause them to get lost in some situations.
@@ -7072,7 +7072,7 @@ Many revisions to better support a Cygwin environment (nijtmans)
2013-08-25 (bug fix)[3016181] Cocoa: [destroy $scrollbar] => crash (goddard)
--- Released 8.6.1, September 19, 2013 --- http://core.tcl.tk/tk/ for details
--- Released 8.6.1, September 19, 2013 --- https://core.tcl-lang.org/tk/ for details
2013-10-27 (bug fix) OSX drawing lags (deily,steffen,walzer)
@@ -7120,7 +7120,7 @@ Many revisions to better support a Cygwin environment (nijtmans)
2014-08-01 (bug fix) OSX font config crash (rob@bitkeeper)
--- Released 8.6.2, August 27, 2014 --- http://core.tcl.tk/tk/ for details
--- Released 8.6.2, August 27, 2014 --- https://core.tcl-lang.org/tk/ for details
2014-08-27 (bug) Cocoa: Crash after [$button destroy] (walzer)
@@ -7144,7 +7144,7 @@ Many revisions to better support a Cygwin environment (nijtmans)
2014-11-07 (bug)[3529885] [scale] handling of negative resolution (vogel)
--- Released 8.6.3, November 12, 2014 --- http://core.tcl.tk/tk/ for details
--- Released 8.6.3, November 12, 2014 --- https://core.tcl-lang.org/tk/ for details
2014-11-14 (bug)[d43a10] shimmer-related crash in [tk_getOpenFile] (nadkarni)
@@ -7166,7 +7166,7 @@ Many revisions to better support a Cygwin environment (nijtmans)
Tk Cocoa 2.0: App Store enabled (walzer,culler,desmera,owen,nyberg,reincke)
*** POTENTIAL INCOMPATIBILITY ***
--- Released 8.6.4, March 12, 2015 --- http://core.tcl.tk/tk/ for details
--- Released 8.6.4, March 12, 2015 --- https://core.tcl-lang.org/tk/ for details
2015-03-10 (bug) Cocoa: premature image free crash (walzer)
@@ -7265,7 +7265,7 @@ Tk Cocoa 2.0: App Store enabled (walzer,culler,desmera,owen,nyberg,reincke)
Tk Cocoa 2.0: More drawing internals refinements (culler,walzer)
--- Released 8.6.5, February 29, 2016 --- http://core.tcl.tk/tk/ for details
--- Released 8.6.5, February 29, 2016 --- https://core.tcl-lang.org/tk/ for details
2016-03-07 (bug)[3137232] spinbox teardown hygiene (vogel)
@@ -7312,4 +7312,389 @@ Tk Cocoa 2.0: More drawing internals refinements (culler,walzer)
2016-07-21 (bug)[450bb0] Aqua: memory corruption from [tk busy] (porter)
--- Released 8.6.6, July 27, 2016 --- http://core.tcl.tk/tk/ for details
--- Released 8.6.6, July 27, 2016 --- https://core.tcl-lang.org/tk/ for details
2016-08-23 (bug)[a2abc4] Wrong warp cursor position on 2nd display (vogel)
2016-08-29 (bug)[fa3229] menu-38.1 (calvo,vogel)
2016-08-29 (bug)[2cf3d6] button-5.24 (vogel)
2016-09-04 (bug)[1534455,2945130] Key release events get _L vs _R right. (vogel)
2016-09-10 (bug)[8c4216] listbox-4.1 (vogel)
2016-09-10 (bug)[eb2681] listbox-13.1 (vogel)
2016-09-21 (bug)[3126428] ttk::button react to image change (thoyts)
2016-10-09 (bug)[1082213] wrapped text don't start lines with whitespace (vogel)
2016-10-12 (bug)[3217462] tri-state button on non-native theme (vogel)
2016-10-30 (bug)[3588460] Fix file dialog -typevariable (vogel)
2016-11-01 (bug)[e36963] event generate .e <diaeresis> (matthias,vogel)
2016-11-05 (bug)[6aea69] grid-23 (danckaert,vogel)
2016-11-18 (bug)[f60c54] combobox-3 (panza,vogel)
2017-01-03 (bug)[f32502] crash drawing many dashed objects (reithofer,werner)
2017-01-05 (bug)[dac92f] text-2.[89] (vogel)
2017-01-07 (bug)[3df559] OSX: Negative bbox width (vogel)
2017-01-07 (bug)[28a453] OSX: text widget index OBOE (vogel)
2017-01-07 (bug)[c12af7] OSX: text-21.1 (vogel)
2017-01-08 (bug)[7a838c] X11 ring buffer overflow (werner)
2017-01-11 (bug)[d4fb4e] imgPhoto-4.75 (nijtmans)
2017-01-18 (bug)[fab5fe] OSX: repair textDisp failures (vogel)
2017-01-23 (bug)[89a638] OSX: textDisp-15.8 (vogel)
2017-01-25 (bug)[1403ea] Limits on text line size on Windows (spjuth)
2017-02-05 (bug)[ae32eb] textDisp fails in text custom config (vogel)
2017-02-05 (bug)[7d967c] crash after IME restart (lanam,nijtmans)
2017-02-22 (bug)[c492c9] disabled combobox arrow appearance (danckaert)
2017-03-06 (bug)[6b3644] Fix -alpha for 16-bit color PNG (LemonMan)
2017-03-11 (bug)[775273] artifacts on Ubuntu 16.10+ (nemethi)
2017-03-26 (TIP 464) Win multimedia keys support (fassel,vogel)
2017-03-29 (bug)[28a3c3] test BTree memleaks plugged (anonymous)
2017-04-06 (bug)[db8c54] Stop freed mem access in warp pointer callback (porter)
2017-04-07 (bugs) Fix calculation of ttk::notebook tab widths (vogel)
2017-04-07 (bug)[291296] notebook tab management (decoster)
2017-04-08 (bug)[f0188a] Win reject invalid hex color codes (bachmann)
2017-04-10 (bug)[3f323b] variable struct size on XCode 8.3.1 (auriocus)
2017-04-20 (bug)[061bf9] OSX scrollbar draw position (reincke,walzer,joye)
2017-05-01 (bug) restore -initialfile for OSX file dialogs (reincke,gollwitzer)
2017-05-06 (bug) OSX file dialog type filters (walzer)
2017-05-10 (bug)[a5ba1c] race condition on Win clipboard cleanup (donchenko)
2017-05-18 (bug)[2433781] center image on button (cramer)
2017-05-19 (bug)[434d29] type mismatch with recent Xft (nijtmans,werner)
2017-06-02 (bug)[bc43fd] paneconfigure get pane heights right (vogel)
2017-06-21 (bug)[adc028] menu avoid unreleasable global grab (nash)
2017-06-30 (bug)[92e028,c5eb90] User switch forced theme reset (lanam)
2017-06-30 (bug)[62c5b7] segfault in [text] replace (werner)
2017-07-03 (bug)[8afc6c] OSX crash in save/open dialogs (simpson,walzer)
2017-08-02 (bug)[b601ce] Resource exhaustion processing corrupt GIF (nash)
2017-08-03 (bug)[9eab54] Fix -initialdir for OSX file dialogs (gollwitzer)
2017-08-08 (bug)[28d0b8] Follow ICCCM advice on X selection protocol (donchenko)
2017-08-08 (bug)[4966ca] Scidb race in notebook tab selection (cramer)
--- Released 8.6.7, August 9, 2017 --- https://core.tcl-lang.org/tk/ for details
2017-08-24 (bug)[f1a3ca] Memory leak in [text] B-tree (edhume3)
2017-08-24 (bug)[ee40fd] Report [console] init errors (the)
2017-08-24 (bug)[3295446] Improve history visibility in [console] (goth)
2017-08-24 (bug) canvas closed polylines fully honor -joinstyle (vogel)
2017-08-24 (bug)[cc42cc] out of mem crash in tests imgPhoto-18.* (vogel)
2017-09-16 (bug)[3406785] fix coords rounding when drawing canvas items (vogel)
2017-09-24 (bug)[8277e1] linux fontchooser sync with available fonts (vogel)
2017-09-24 (bug)[5239fd] Segfault copying a photo image to itself (bachmann)
2017-09-24 (bug)[514ff6] canvas rotated text overlap detection (vogel)
2017-09-24 (bug)[1e0db2] canvas rchars artifacts (bruchie,vogel)
2017-10-07 (bug)[d9fdfa] display of Long non-wrapped lines in text (cramer)
2017-10-07 (bug)[dd9667] text anchor not set (vogel)
2017-10-11 (bugs) memleaks and other changes for macOS 10.13 support (culler)
2017-10-11 (bug)[111de2] macOS colorspace improvement (walzer,culler)
2017-10-13 (bug) macOS scrolling issues (culler)
2017-10-15 (bug) clipping regions in scrolling and drawing on macOS (culler)
2017-10-15 (bug) macOS redraw artifacts (culler)
2017-10-22 (bug)[bb6b40] ::tk::AmpMenuArgs and 'entryconf' (vogel)
2017-10-22 (bug)[55b95f] Crash [scale] with a bignum value (vogel)
2017-10-28 (bug)[ce62c8] text-37.1 fails (vogel)
2017-11-03 (bug)[0ef1c5] OS X - tests menu-22.[345] hang (vogel)
2017-11-04 (bug)[c8c52b] repair OBOE in menu.test on macOS (vogel)
2017-11-11 (feature) Implement [wm_iconphoto] on macOS (walzer)
2017-11-11 (bug) display of embedded toplevels (culler)
2017-11-19 (bug)[73ba07] Correct property type for MULTIPLE conversion (dpb)
2017-11-20 (bug) Memory leak in tkImgPhoto.c. (werner)
2017-11-21 (bug) Defeat zombie toplevels (culler)
2017-11-25 (bug) macOS resposive menu bar for command line apps (culler)
2017-11-25 (bug)[1c659e] support png from mac screenshots (vogel)
2017-11-25 (bug)[de4af1] macOS file selector "all types" setting (culler)
2017-11-26 (bug) [wm withdraw] on Window and Dock menus (walzer)
2017-11-27 (feature) Drop support for macOS 10.5 (culler)
2017-11-30 (bug)[164c1b] Fixes [raise] on macOS (culler)
2017-11-30 (bug)[13d63d] macOS support of menu -postcommand (culler)
2017-12-05 (bug) enable custom icon display on macOS (walzer)
2017-12-05 (bug)[1088805,0feb63] macOS bind failures (culler)
2017-12-05 (bug)[3382424] Suppress noisy messages on macOS (culler)
2017-12-08 (new)[TIP 477] nmake build system reform (nadkarni)
2017-12-18 (bug)[b77626] Make [tk busy -cursor] silent no-op on macOS (vogel)
--- Released 8.6.8, December 22, 2017 --- https://core.tcl-lang.org/tk/ for details
2017-12-31 (bug)[aa7679] crash using window after master destroyed (vogel)
2017-12-31 (bug)[6525e1] encoding leak in tkMacOSXProcessFiles (werner)
2018-01-07 (bug)[925262] New option -state for ttk::scale (vogel)
2018-01-07 (bug)[fa8de7] Crash [ttk::checkbutton .x -variable {}] (werner)
2018-01-16 (bug)[382712] Crash in [event generate . <KeyPress>] (werner)
2018-01-19 (bug)[657c38] Crash in menu destroy with checkbutton entry (werner)
2018-01-25 (bug)[de156e] Deny PRIMARY selection access in safe interps (nash)
2018-01-28 (bug)[b68710] Fixes in [text] bindings (nash)
2018-01-28 (bug)[e20d5c] Stop failures of textTag-18.1 (vogel)
2018-02-04 (bug)[5d991b] Fortify var traces against deleted vars (vogel)
2018-02-10 (bug)[1821174] Stop RenderBadPicture X error (werner)
2018-02-11 (bug)[502e74] Stop X errors on untrusted connections (werner)
2018-03-07 (bug)[71b131] Regression in Tk_DrawChars() (werner,cramer)
2018-04-03 (bug)[59fccb] menu flaws when empty menubar clicked (vogel,mcdonald)
2018-04-28 (bug)[7423f9] improved legacy support for [tk_setPalette] (bll)
2018-04-30 (bug)[6d5042] enable [tk inactive] on Mac OSX (culler)
2018-05-03 (bug)[75d38f] fix touchpad scroll of listbox on win notebook (vogel)
2018-06-16 (bug)[de01e2] Crash in [$text replace] (vogel)
2018-07-04 (bug)[6ca257] Fix [wm resizable] on Mac OSX (culler)
2018-07-04 (bug)[135696] Crash in [wm transient] (culler)
2018-07-04 (bug)[309b42] Improve ttk high-contrast-mode support (lemburg,vogel)
2018-07-17 (bug)[1088825] fix frame-2.17,3.9,3.10 on Mac (vogel)
2018-07-27 (bug)[fabed1] GIF photo support for "deferred clear code" (vogel)
2018-08-08 (feature) Modern full-screen support on Mac OSX (walzer)
2018-08-12 (bug)[1875c1] scrollbar on Mac OSX (walzer)
2018-08-14 (bug)[1ba71a] KeyRelease events on Mac OSX(walzer)
2018-09-02 (bug)[3441086] error message in layout-2 (vogel)
2018-09-07 (bug)[05bd7f] vista theme for combobox (vogel)
2018-09-08 (bug)[382712] crash in KeyPress event handling (vogel,werner)
2018-09-08 (bug)[6fcaaa] insertion cursor visibility in ttk::entry (nemethi)
2018-09-30 (bug)[822923] cascade menu indicator color (mcdonald)
2018-10-06 (bug)[9658bc] borderwidth calculations on menu items (vogel)
2018-10-17 (bug)[ca403f] treeview border drawing (vogel)
2018-10-17 (bug)[4b555a] hang in [$text search -all] (vogel,danckaert)
2018-10-30 (new platform) port to system changes in Mac OSX 10.14 (culler)
2018-11-04 (bug)[6b22d4] [treeview] binding fix (ohagan)
- Released 8.6.9, November 16, 2018 - https://core.tcl-lang.org/tk/ for details
2018-11-19 (bug)[0a9c91] crash in text-11a.22 (vogel)
2018-11-20 (bug)[9705d1] crash activating "Alt" theme (culler)
2018-11-24 (bug)[e3b954] cursor offset at full screen display (culler)
2019-01-04 (bug)[18a4ba] cross-platform [winfo containing] (culler)
2019-01-08 (feature) local grab on Mac OSX (culler)
2019-01-10 (build) 'None', 'ControlMask' symbol conflicts (nijtmans)
2019-01-20 (bug)[509caf] [treeview tag configure] regression (mcdonald,vogel)
2019-01-26 (bug)[3003895] [scale] res rounds and -from (tischler,pieper,vogel)
2019-02-02 (new)[TIP 533] [$mb post x y idx] (culler,vogel)
2019-02-08 (bug)[1529659] embed toplevel blocks outer menu (culler)
2019-02-10 (bug)[8814bd] crash in [NSMenu size] (culler)
2019-02-13 (bug)[b389df] Aqua: mouse position on dual screen (culler)
2019-02-23 (bug)[56a182] Aqua: [tk_getOpenFile] causes off-screen toplevels (culler,walzer)
2019-02-23 (bug)[9771ae] Aqua: workaround incompatible transient window models (culler,walzer)
2019-03-01 (bug)[1951ab] Prevent transient window cycles (crashed on Aqua) (culler,vogel)
*** POTENTIAL INCOMPATIBILITY ***
2019-03-04 (bug)[4da219] Incomplete read of multi-image GIF (oehlmann)
2019-03-14 (bug)[609e00] Aqua: wrong coords from MouseWheel binding (vogel,culler)
2019-03-25 (bug)[48c394] Aqua: recompute text layout for empty string (culler)
2019-03-31 (new)[TIP 535] Precision of ::scale widget tick mark values (vogel)
*** POTENTIAL INCOMPATIBILITY ***
2019-03-31 (bug)[da3914] [$treeview identify element] failure (ulfalizer,vogel)
2019-04-06 (bug)[897ffe] Prevent cross-manager loops of geom management (culler,vogel)
2019-04-11 (new) Apple Dark Mode support (culler)
2019-04-14 (new) Aqua: Use color names consistent with NSColor (culler)
*** POTENTIAL INCOMPATIBILITY ***
2019-04-14 (new) Aqua: [tk::unsupported::MacWindowStyle isdark] (culler)
2019-04-19 (bug)[368fa4] Prevent toggle of hidden treeview indicators (ulfalizer,vogel)
2019-04-24 (bug)[4d2e8d] Aqua: notebook pane redraws (culler)
2019-04-24 (bug)[928652] Apply TIP 533 for ttk::menubutton (culler,vogel)
2019-04-24 (bug)[1001070] X-platform rework of label options -highlight* (seal,culler,vogel)
2019-04-28 (bug)[6286fd] checkbutton handling of -selectcolor (ralfixx)
2019-04-30 (bug)[4f9a99] Win: crash in [style element create] (oehlman,vogel)
2019-05-08 (bug) Ttk scrolling bugs, see tests treeview-9.1, entry-3.[3-6] (vogel)
2019-05-08 (bug)[51b4b1] Aqua: combobox use native ttk scrollbar (bll,vogel)
*** POTENTIAL INCOMPATIBILITY ***
2019-05-18 (new)[eb2996] Win: support for horizontal scrolling (chavez,vogel)
2019-05-26 (new)[TIP 541] [combobox current] support "end" index (vogel)
2019-05-26 (bug)[2a6c62] <<TreeviewSelect>> trigger on item delete (vogel)
2019-06-05 (bug)[9ebc6f] Aqua: fix incorrect reports of mouse coords (chavez, culler)
2019-06-14 (bug)[436ad6] Corrected Aqua regressions in [wm manage] (walzer, culler)
2019-06-15 (bug)[75b8fb] Crash with some [event generate]d <ButtonRelease> (leunissen,vogel)
2019-06-15 (new)[TIP 536] New tk::mac::* commands for IPC on Mac OSX (walzer)
2019-07-13 (bug)[4566e2] Aqua: Make default background color of Tk and Ttk agree (walzer,culler)
*** POTENTIAL INCOMPATIBILITY ***
2019-07-16 (bug)[5ddeca] Stop app switching exposing withdrawn windows as zombies (culler)
2019-07-25 (new)[1fb7af] Win support for buttons 4 and 5 (chavez,vogel,nijtmans)
2019-08-18 (new) Refactor all MouseWheel bindings (nijtmans)
*** POTENTIAL INCOMPATIBILITY ***
2019-08-21 (bug)[c8ccd1] up array key in [text] takes to index 1.0 (ulfalizer,vogel)
2019-08-28 (new)[TIP 532] Tk event loop rewrite to prevent ring overflow (cramer)
*** POTENTIAL INCOMPATIBILITY ***
2019-08-28 (bug)[943d5e] Win: embedded widget destruction cancels window resize (nemethi,vogel,nijtmans)
2019-09-12 (bug)[2834776] Stop disabled spinbox from generating <<Increment>> & <<Decrement>> (vogel)
2019-09-24 (bug)[96bce5] Aqua: Prevent crash drawing 1x1 rounded rectangles (bll,culler)
2019-10-03 (bug)[3ed5b6] Win: root window position with highlightthickness>0 (leunissem,vogel,nijtmans)
2019-10-09 (bug)[a01b6f7] Workaround XWayland bug reporting screen width (werner,nijtmans)
2019-10-10 (bug) Aqua: Prevent crash deactivating menu during menu deletion (culler)
2019-10-21 (bug)[aea00b] Aqua: Better handling of resolution changes (chavez, culler)
2019-10-25 (bug)[b82bd4] Fix [style configure -compound] (culler,vogel)
2019-10-27 (bug)[f7a4f7] Aqua: embedded toplevel, forced focus and mouse coords (naaus,culler)
2019-11-13 (new) Win: keycodes Mail, AudioMedia, Launch0, Launch1 (nijtmans)
2019-11-15 (bug)[69b48f] failing test textTag-18.1 (vogel)
2019-11-17 (bug)[c4abd2] panic in stackorder command (culler)
2019-11-17 (bug)[53d280] [wm iconphoto] crash on empty image (culler)
2019-11-17 [90d555] workaround NSFontManager bad selections (culler)
2019-11-19 (new) Partial Emoji support in text displays (nijtmans,culler)
- Released 8.6.10, Nov 21, 2019 - https://core.tcl-lang.org/tk/ for details

View File

@@ -29,7 +29,6 @@ extern char * malloc(unsigned int numBytes);
extern void qsort(void *base, int n, int size, int (*compar)(
const void *element1, const void *element2));
extern char * realloc(char *ptr, unsigned int numBytes);
extern double strtod(const char *string, char **endPtr);
extern long strtol(const char *string, char **endPtr, int base);
extern unsigned long strtoul(const char *string, char **endPtr, int base);

View File

@@ -144,7 +144,7 @@ like this:
.PP
.CS
static const Tk_CustomOption tagsOption = {Tk_CanvasTagsParseProc,
Tk_CanvasTagsPrintProc, (ClientData) NULL
Tk_CanvasTagsPrintProc, NULL
};
static const Tk_ConfigSpec configSpecs[] = {

View File

@@ -31,7 +31,7 @@ drop applications.
The callback to \fIproc\fR will be made by \fBTk_HandleEvent\fR;
this mechanism only works in programs that dispatch events
through \fBTk_HandleEvent\fR (or through other Tk procedures that
call \fBTk_HandleEvent\fR, such as \fBTk_DoOneEvent\fR or
call \fBTk_HandleEvent\fR, such as \fBTcl_DoOneEvent\fR or
\fBTk_MainLoop\fR).
.PP
\fIProc\fR should have arguments and result that match the

View File

@@ -38,7 +38,7 @@ use with Tk, and so on.
The callback to \fIproc\fR will be made by \fBTk_HandleEvent\fR;
this mechanism only works in programs that dispatch events
through \fBTk_HandleEvent\fR (or through other Tk procedures that
call \fBTk_HandleEvent\fR, such as \fBTk_DoOneEvent\fR or
call \fBTk_HandleEvent\fR, such as \fBTcl_DoOneEvent\fR or
\fBTk_MainLoop\fR).
.PP
\fIProc\fR should have arguments and result that match the

View File

@@ -38,7 +38,7 @@ by \fImask\fR occurs in the window specified by \fItkwin\fR.
The callback to \fIproc\fR will be made by \fBTk_HandleEvent\fR;
this mechanism only works in programs that dispatch events
through \fBTk_HandleEvent\fR (or through other Tk procedures that
call \fBTk_HandleEvent\fR, such as \fBTk_DoOneEvent\fR or
call \fBTk_HandleEvent\fR, such as \fBTcl_DoOneEvent\fR or
\fBTk_MainLoop\fR).
.PP
\fIProc\fR should have arguments and result that match the

View File

@@ -4,7 +4,7 @@
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\"
'\" Author: Paul Mackerras (paulus@cs.anu.edu.au),
'\" Department of Computer Science,
'\" Australian National University.
@@ -99,8 +99,8 @@ being written to the photo image.
particular photo image to the other procedures. The parameter is the
name of the image, that is, the name specified to the \fBimage create
photo\fR command, or assigned by that command if no name was specified.
If \fIimageName\fR does not exist or is not a photo image,
\fBTk_FindPhoto\fR returns NULL.
If \fIimageName\fR does not exist or is not a photo image,
\fBTk_FindPhoto\fR returns NULL.
.PP
\fBTk_PhotoPutBlock\fR is used to supply blocks of image data to be
displayed. The call affects an area of the image of size
@@ -130,14 +130,23 @@ The \fIpixelPtr\fR field points to the first pixel, that is, the
top-left pixel in the block.
The \fIwidth\fR and \fIheight\fR fields specify the dimensions of the
block of pixels. The \fIpixelSize\fR field specifies the address
difference between two horizontally adjacent pixels. Often it is 3
or 4, but it can have any value. The \fIpitch\fR field specifies the
difference between two horizontally adjacent pixels. It should be 4 for
RGB and 2 for grayscale image data. Other values are possible, if the
offsets in the \fIoffset\fR array are adjusted accordingly (e.g. for
red, green and blue data stored in different planes). Using such a
layout is strongly discouraged, though. Due to a bug, it might not work
correctly if an alpha channel is provided. (see the \fBBUGS\fR section
below). The \fIpitch\fR field specifies the
address difference between two vertically adjacent pixels. The
\fIoffset\fR array contains the offsets from the address of a pixel
to the addresses of the bytes containing the red, green, blue and alpha
(transparency) components. These are normally 0, 1, 2 and 3, but can
have other values, e.g., for images that are stored as separate red,
green and blue planes.
(transparency) components. If the offsets for red, green and blue are
equal, the image is interpreted as grayscale. If they differ, RGB data
is assumed. Normally the offsets will be 0, 1, 2, 3 for RGB data
and 0, 0, 0, 1 for grayscale. It is possible to provide image data
without an alpha channel by setting the offset for alpha to a negative
value and adjusting the \fIpixelSize\fR field accordingly. This use is
discouraged, though (see the \fBBUGS\fR section below).
.PP
The \fIcompRule\fR parameter to \fBTk_PhotoPutBlock\fR specifies a
compositing rule that says what to do with transparent pixels. The
@@ -184,16 +193,16 @@ that describe the address and layout of the image data that the
photo image has stored internally. The values are valid
until the image is destroyed or its size is changed.
.PP
It is possible to modify an image by writing directly to the data
It is possible to modify an image by writing directly to the data
the \fIpixelPtr\fR field points to. The size of the image cannot be
changed this way, though.
Also, changes made by writing directly to \fIpixelPtr\fR will not be
immediately visible, but only after a call to
\fBTk_ImageChanged\fR or after an event that causes the interested
Also, changes made by writing directly to \fIpixelPtr\fR will not be
immediately visible, but only after a call to
\fBTk_ImageChanged\fR or after an event that causes the interested
widgets to redraw themselves.
For these reasons usually it is preferable to make changes to
a copy of the image data and write it back with
\fBTk_PhotoPutBlock\fR or \fBTk_PhotoPutZoomedBlock\fR.
For these reasons usually it is preferable to make changes to
a copy of the image data and write it back with
\fBTk_PhotoPutBlock\fR or \fBTk_PhotoPutZoomedBlock\fR.
.PP
\fBTk_PhotoGetImage\fR returns 1 for compatibility with the
corresponding procedure in the old photo widget.
@@ -248,6 +257,24 @@ memory was available for an image, Tk would panic. This behaviour is
still supported if you compile your extension with the additional flag
-DUSE_PANIC_ON_PHOTO_ALLOC_FAILURE. Code linked using Stubs against
older versions of Tk will continue to work.
.SH BUGS
The \fBTk_PhotoImageBlock\fR structure used to provide image data to
\fBTk_PhotoPutBlock\fR promises great flexibility in the layout of the
data (e.g. separate planes for the red, green, blue and alpha
channels). Unfortunately, the implementation fails to hold this
promise. The problem is that the \fIpixelSize\fR field is
(incorrectly) used to determine whether the image has an alpha channel.
Currently, if the offset for the alpha channel is greater or equal than
\fIpixelSize\fR, \fBtk_PhotoPutblock\fR assumes no alpha data is
present and makes the image fully opaque. This means that for layouts
where the channels are separate (or any other exotic layout where
\fIpixelSize\fR has to be smaller than the alpha offset), the alpha
channel will not be read correctly. In order to be on the safe side
if this issue will be corrected in a future release, it is strongly
recommended you always provide alpha data - even if the image has no
transparency - and only use the "standard" layout with a
\fIpixelSize\fR of 2 for grayscale and 4 for RGB data with
\fIoffset\fRs of 0, 0, 0, 1 or 0, 1, 2, 3 respectively.
.SH CREDITS
.PP
The code for the photo image type was developed by Paul Mackerras,

View File

@@ -15,10 +15,10 @@ Tk_GetScrollInfoObj, Tk_GetScrollInfo \- parse arguments for scrolling commands
\fB#include <tk.h>\fR
.sp
int
\fBTk_GetScrollInfoObj(\fIinterp, objc, objv, dblPtr, intPtr\fB)\fR
\fBTk_GetScrollInfoObj(\fIinterp, objc, objv, fractionPtr, stepsPtr\fB)\fR
.sp
int
\fBTk_GetScrollInfo(\fIinterp, argc, argv, dblPtr, intPtr\fB)\fR
\fBTk_GetScrollInfo(\fIinterp, argc, argv, fractionPtr, stepsPtr\fB)\fR
.SH ARGUMENTS
.AS "Tcl_Interp" *fractionPtr
.AP Tcl_Interp *interp in

View File

@@ -25,7 +25,7 @@ that all unused fields of the structure be set to zero.
.PP
\fBTk_HandleEvent\fR is a lower-level procedure that deals with window
events. It is called by \fBTcl_ServiceEvent\fR (and indirectly by
\fBTk_DoOneEvent\fR), and in a few other cases within Tk.
\fBTcl_DoOneEvent\fR), and in a few other cases within Tk.
It makes callbacks to any window event
handlers (created by calls to \fBTk_CreateEventHandler\fR)
that match \fIeventPtr\fR and then returns. In some cases

View File

@@ -14,7 +14,7 @@ Tk_GetUserInactiveTime, Tk_ResetUserInactiveTime \- discover user inactivity tim
long
\fBTk_GetUserInactiveTime(\fIdisplay\fB)\fR
.sp
\fBTk_GetUserInactiveTime(\fIdisplay\fB)\fR
\fBTk_ResetUserInactiveTime(\fIdisplay\fB)\fR
.SH ARGUMENTS
.AS Display *display
.AP Display *display in
@@ -26,8 +26,8 @@ reset.
\fBTk_GetUserInactiveTime\fR returns the number of milliseconds that
have passed since the last user interaction (usually via keyboard or
mouse) with the respective display. On systems and displays that do not
support querying the user inactiviy time, \fB\-1\fR is returned.
\fBTk_GetUserInactiveTime\fR resets the user inactivity timer of the
support querying the user inactivity time, \fB\-1\fR is returned.
\fBTk_ResetUserInactiveTime\fR resets the user inactivity timer of the
given display to zero. On windowing systems that do not support
multiple displays \fIdisplay\fR can be passed as \fBNULL\fR.
.SH KEYWORDS

View File

@@ -46,6 +46,6 @@ menus that want to appear at a particular place on the screen.
When \fBTk_MoveToplevelWindow\fR is called it does not immediately
pass on the new desired location to the window manager; it defers
this action until all other outstanding work has been completed,
using the \fBTk_DoWhenIdle\fR mechanism.
using the \fBTcl_DoWhenIdle\fR mechanism.
.SH KEYWORDS
position, top-level window, window manager

View File

@@ -3,7 +3,7 @@
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\"
.TH Tk_NameOfImage 3 4.0 Tk "Tk Library Procedures"
.so man.macros
.BS
@@ -14,10 +14,10 @@ Tk_NameOfImage \- Return name of image.
\fB#include <tk.h>\fR
.sp
const char *
\fBTk_NameOfImage\fR(\fItypePtr\fR)
\fBTk_NameOfImage\fR(\fIimageMaster\fR)
.SH ARGUMENTS
.AS Tk_ImageMaster *masterPtr
.AP Tk_ImageMaster *masterPtr in
.AS Tk_ImageMaster imageMaster
.AP Tk_ImageMaster imageMaster in
Token for image, which was passed to image manager's \fIcreateProc\fR when
the image was created.
.BE

View File

@@ -314,14 +314,14 @@ Boolean exec = FALSE;
Tk_ArgvInfo argTable[] = {
{"\-X", TK_ARGV_CONSTANT, (char *) 1, (char *) &debugFlag,
"Turn on debugging printfs"},
{"\-N", TK_ARGV_INT, (char *) NULL, (char *) &numReps,
{"\-N", TK_ARGV_INT, NULL, (char *) &numReps,
"Number of repetitions"},
{"\-of", TK_ARGV_STRING, (char *) NULL, (char *) &fileName,
{"\-of", TK_ARGV_STRING, NULL, (char *) &fileName,
"Name of file for output"},
{"x", TK_ARGV_REST, (char *) NULL, (char *) &exec,
{"x", TK_ARGV_REST, NULL, (char *) &exec,
"File to exec, followed by any arguments (must be last argument)."},
{(char *) NULL, TK_ARGV_END, (char *) NULL, (char *) NULL,
(char *) NULL}
{NULL, TK_ARGV_END, NULL, NULL,
NULL}
};
main(argc, argv)

View File

@@ -30,7 +30,7 @@ Pointer to place to save argument to previous restrict procedure.
.PP
This procedure is useful in certain situations where applications
are only prepared to receive certain X events. After
\fBTk_RestrictEvents\fR is called, \fBTk_DoOneEvent\fR (and
\fBTk_RestrictEvents\fR is called, \fBTcl_DoOneEvent\fR (and
hence \fBTk_MainLoop\fR) will filter X input events through
\fIproc\fR. \fIProc\fR indicates whether a
given event is to be processed immediately, deferred until some
@@ -48,7 +48,7 @@ to \fBTk_RestrictEvents\fR; it may be used to provide \fIproc\fR with
information it needs to filter events. The \fIeventPtr\fR points to
an event under consideration. \fIProc\fR returns a restrict action
(enumerated type \fBTk_RestrictAction\fR) that indicates what
\fBTk_DoOneEvent\fR should do with the event. If the return value is
\fBTcl_DoOneEvent\fR should do with the event. If the return value is
\fBTK_PROCESS_EVENT\fR, then the event will be handled immediately.
If the return value is \fBTK_DEFER_EVENT\fR, then the event will be
left on the event queue for later processing. If the return value is
@@ -74,6 +74,6 @@ solution in these situations is to call \fBXNextEvent\fR or
\fBXWindowEvent\fR, but these procedures cannot be used because
Tk keeps its own event queue that is separate from the X event
queue. Instead, call \fBTk_RestrictEvents\fR to set up a filter,
then call \fBTk_DoOneEvent\fR to retrieve the desired event(s).
then call \fBTcl_DoOneEvent\fR to retrieve the desired event(s).
.SH KEYWORDS
delay, event, filter, restriction

View File

@@ -56,7 +56,7 @@ The \fIinstanceData\fR parameter passed to the \fIworldChangedProc\fR
will be identical to the \fIinstanceData\fR parameter passed to
\fBTk_SetClassProcs\fR.
.PP
\fIcreateProc\fR is used to create platform-dependant windows. It is
\fIcreateProc\fR is used to create platform-dependent windows. It is
invoked by \fBTk_MakeWindowExist\fR. \fIcreateProc\fR should have
arguments and results that match the type \fBTk_ClassCreateProc\fR:
.CS

View File

@@ -5,7 +5,7 @@
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\"
.TH bind n 8.0 Tk "Tk Built-In Commands"
.so man.macros
.BS
@@ -19,9 +19,10 @@ bind \- Arrange for X events to invoke Tcl scripts
.PP
The \fBbind\fR command associates Tcl scripts with X events.
If all three arguments are specified, \fBbind\fR will
arrange for \fIscript\fR (a Tcl script) to be evaluated whenever
the event(s) given by \fIsequence\fR occur in the window(s)
identified by \fItag\fR.
arrange for \fIscript\fR (a Tcl script called the
.QW "binding script")
to be evaluated whenever the event(s) given by \fIsequence\fR
occur in the window(s) identified by \fItag\fR.
If \fIscript\fR is prefixed with a
.QW + ,
then it is appended to
@@ -387,7 +388,8 @@ For example, \fB<Control\-comma>\fR is equivalent to
\fB<Control\-KeyPress\-comma>\fR.
.SH "BINDING SCRIPTS AND SUBSTITUTIONS"
.PP
The \fIscript\fR argument to \fBbind\fR is a Tcl script,
The \fIscript\fR argument to \fBbind\fR is a Tcl script, called the
.QW "binding script",
which will be executed whenever the given event sequence occurs.
\fICommand\fR will be executed in the same interpreter that the
\fBbind\fR command was executed in, and it will run at global
@@ -564,8 +566,8 @@ The \fIx_root\fR and \fIy_root\fR fields from the event.
If a virtual-root window manager is being used then the substituted
values are the corresponding x-coordinate and y-coordinate in the virtual root.
Valid only for
\fBButtonPress\fR, \fBButtonRelease\fR, \fBKeyPress\fR, \fBKeyRelease\fR,
and \fBMotion\fR events.
\fBButtonPress\fR, \fBButtonRelease\fR, \fBEnter\fR, \fBKeyPress\fR,
\fBKeyRelease\fR, \fBLeave\fR and \fBMotion\fR events.
Same meaning as \fB%x\fR and \fB%y\fR, except relative to the (virtual) root
window.
.LP
@@ -606,13 +608,21 @@ the window.
.PP
The \fBcontinue\fR and \fBbreak\fR commands may be used inside a
binding script to control the processing of matching scripts.
If \fBcontinue\fR is invoked, then the current binding script
is terminated but Tk will continue processing binding scripts
associated with other \fItag\fR's.
If \fBcontinue\fR is invoked within a binding script, then this
binding script, including all other
.QW +
appended scripts, is terminated but Tk will continue processing
binding scripts associated with other \fItag\fR's.
If the \fBbreak\fR command is invoked within a binding script,
then that script terminates and no other scripts will be invoked
for the event.
.PP
Within a script called from the binding script, \fBreturn\fR
\fB-code ok\fR may be used to continue processing (including
.QW +
appended scripts), or \fBreturn\fR \fB-code break\fR may be used to
stop processing all other binding scripts.
.PP
If more than one binding matches a particular event and they
have the same \fItag\fR, then the most specific binding
is chosen and its script is evaluated.
@@ -628,11 +638,11 @@ of events matched) is more specific than a shorter sequence;
.IP (c)
if the modifiers specified in one pattern are a subset of the
modifiers in another pattern, then the pattern with more modifiers
is more specific.
is more specific;
.IP (d)
a virtual event whose physical pattern matches the sequence is less
specific than the same physical pattern that is not associated with a
virtual event.
virtual event;
.IP (e)
given a sequence that matches two or more virtual events, one
of the virtual events will be chosen, but the order is undefined.

View File

@@ -28,7 +28,7 @@
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
busy \- confine pointer and keyboard events to a window sub-tree
busy \- confine pointer events to a window sub-tree
.SH SYNOPSIS
\fBtk busy\fR \fIwindow \fR?\fIoptions\fR?
.sp
@@ -44,9 +44,10 @@ busy \- confine pointer and keyboard events to a window sub-tree
.BE
.SH DESCRIPTION
.PP
The \fBtk busy\fR command provides a simple means to block keyboard, button,
and pointer events from Tk widgets, while overriding the widget's cursor with
a configurable busy cursor.
The \fBtk busy\fR command provides a simple means to block pointer events from
Tk widgets, while overriding the widget's cursor with a configurable busy
cursor. Note this command does not prevent keyboard events from being sent to
the widgets made busy.
.SH INTRODUCTION
.PP
There are many times in applications where you want to temporarily restrict
@@ -68,8 +69,8 @@ that overrides the widget's normal cursor, providing feedback that the
application (widget) is temporarily busy.
.PP
When a widget is made busy, the widget and all of its descendants will ignore
events. It's easy to make an entire panel of widgets busy. You can simply make
the toplevel widget (such as
pointer events. It's easy to make an entire panel of widgets busy. You can
simply make the toplevel widget (such as
.QW . )
busy. This is easier and far much more efficient than recursively traversing
the widget hierarchy, disabling each widget and re-configuring its cursor.
@@ -240,20 +241,27 @@ widgets.
.SS "KEYBOARD EVENTS"
.PP
When a widget is made busy, the widget is prevented from gaining the keyboard
focus by the busy window. But if the widget already had focus, it still may
received keyboard events. To prevent this, you must move focus to another
window.
focus by a user clicking on it by the busy window. But if the widget already had
focus, it still may receive keyboard events. The widget can also still receive
focus through keyboard traversal. To prevent this, you must move
focus to another window and make sure the focus can not go back to the widgets
made busy (e.g. but restricting focus to a cancel button).
.PP
.CS
pack [frame .frame]
pack [text .frame.text]
\fBtk busy\fR hold .frame
label .dummy
focus .dummy
pack [button .cancel -text "Cancel" -command exit]
focus .cancel
bind .cancel <Tab> {break}
bind .cancel <Shift-Tab> {break}
update
.CE
.PP
The above example moves the focus from .frame immediately after invoking the
\fBhold\fR so that no keyboard events will be sent to \fB.frame\fR or any of
its descendants.
its descendants. It also makes sure it's not possible to leave button
\fB.cancel\fR using the keyboard.
.SH PORTABILITY
.PP
Note that the \fBtk busy\fR command does not currently have any effect on OSX

View File

@@ -547,6 +547,15 @@ If coordinates are specified, then they replace the current
coordinates for the named item.
If \fItagOrId\fR refers to multiple items, then
the first one in the display list is used.
.RS
.PP
Note that for rectangles, ovals and arcs the returned list of coordinates
has a fixed order, namely the left, top, right and bottom coordinates,
which may not be the order originally given. Also the coordinates are always
returned in screen units with no units (that is, in pixels). So if the
original coordinates were specified for instance in centimeters or inches,
the returned values will nevertheless be in pixels.
.RE
.TP
\fIpathName \fBcreate \fItype x y \fR?\fIx y ...\fR? ?\fIoption value ...\fR?
.TP
@@ -1210,10 +1219,10 @@ in the \fBCOORDINATES\fR section above.
Specifies the color to be used to fill item's area.
in its normal, active, and disabled states,
\fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR.
If \fIcolor\fR is an empty string (the default),
then the item will not be filled.
For the line item, it specifies the color of the line drawn.
For the text item, it specifies the foreground color of the text.
If \fIcolor\fR is an empty string (the default for all canvas items
except line and text), then the item will not be filled.
.TP
\fB\-outline \fIcolor\fR
.TP
@@ -1224,8 +1233,8 @@ For the text item, it specifies the foreground color of the text.
This option specifies the color that should be used to draw the
outline of the item in its normal, active and disabled states.
\fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR.
This option defaults to \fBblack\fR. If \fIcolor\fR is specified
as an empty string then no outline is drawn for the item.
If \fIcolor\fR is specified as an empty string then no outline is drawn
for the item.
.TP
\fB\-offset \fIoffset\fR
.
@@ -1433,8 +1442,7 @@ disabled states.
Specifies the color to use for each of the bitmap's
.QW 1
valued pixels in its normal, active and disabled states.
\fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR and
defaults to \fBblack\fR.
\fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR.
.SS "IMAGE ITEMS"
.PP
Items of type \fBimage\fR are used to display images on a

View File

@@ -17,6 +17,13 @@ The procedure \fBtk_chooseDirectory\fR pops up a dialog box for the
user to select a directory. The following \fIoption\-value\fR pairs are
possible as command line arguments:
.TP
\fB\-command\fR \fIstring\fR
Specifies the prefix of a Tcl command to invoke when the user closes the
dialog after having selected an item. This callback is not called if the
user cancelled the dialog. The actual command consists of \fIstring\fR
followed by a space and the value selected by the user in the dialog. This
is only available on Mac OS X.
.TP
\fB\-initialdir\fR \fIdirname\fR
Specifies that the directories in \fIdirectory\fR should be displayed
when the dialog pops up. If this parameter is not specified,
@@ -27,6 +34,10 @@ user-selected directory for the application. If the
parameter specifies a relative path, the return value will convert the
relative path to an absolute path.
.TP
\fB\-message\fR \fIstring\fR
Specifies a message to include in the client area of the dialog.
This is only available on Mac OS X.
.TP
\fB\-mustexist\fR \fIboolean\fR
Specifies whether the user may specify non-existent directories. If
this parameter is true, then the user may only select directories that

View File

@@ -784,9 +784,10 @@ YellowGreen 154 205 50
.TP
\fBMac OS X\fR
.
On Mac OS X, the following additional system colors are available
(note that the actual color values depend on the currently active OS theme,
and typically many of these will in fact be patterns rather than pure colors):
On macOS, the following additional system colors are available.
This first group contains all colors available in the HIToolbox library.
(Note that in some cases the actual color values may depend on the
current Appearance.)
.RS
.DS
systemActiveAreaFill
@@ -900,6 +901,7 @@ systemScrollBarDelimiterActive
systemScrollBarDelimiterInactive
systemSecondaryGroupBoxBackground
systemSecondaryHighlightColor
systemSelectedTabTextColor
systemSheetBackground
systemSheetBackgroundOpaque
systemSheetBackgroundTransparent
@@ -925,7 +927,40 @@ systemWindowHeaderBackground
systemWindowHeaderInactiveText
.DE
.RE
.
The second group of MacOS colors below are based on Apple's "semantic"
NScolors. On OSX 10.14 (Mojave) and later these colors change value
when Dark Mode is enabled. However, the change is only observable
when the Apple window manager is drawing to the screen. So the
\fBwinfo rgb\fR command will return the color coordinates used in the
standard Aqua mode, even if Dark Mode has been selected in the system
preferences. The numbered systemWindowBackgroundColors are used in
the \fBttk::notebook\fR and \fBttk::labelframe\fR widgets to provide a
contrasting background. Each numbered color constrasts with its
predecessor.
.RS
.DS
systemControlAccentColor
systemControlTextColor
systemDisabledControlTextColor
systemLabelColor
systemSelectedTextBackgroundColor
systemSelectedTextColor
systemTextBackgroundColor
systemTextColor
systemWindowBackgroundColor
systemWindowBackgroundColor1
systemWindowBackgroundColor2
systemWindowBackgroundColor3
systemWindowBackgroundColor4
systemWindowBackgroundColor5
systemWindowBackgroundColor6
systemWindowBackgroundColor7
.DE
.RE
.TP
\fBWindows\fR
.
On Windows, the following additional system colors are available

View File

@@ -239,7 +239,8 @@ Similar to \fB%S\fR substitution for binding scripts.
.TP
\fB\-time\fI integer\fR
\fIInteger\fR must be an integer value; it specifies the \fItime\fR field
for the event.
for the event. Additonally the special value \fBcurrent\fR is allowed,
this value will be substituted by the current event time.
Valid for \fBKeyPress\fR, \fBKeyRelease\fR, \fBButtonPress\fR,
\fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, \fBMotion\fR,
and \fBProperty\fR events.
@@ -338,7 +339,9 @@ This is sent to a text widget when the selection in the widget is
changed.
.TP
\fB<<ThemeChanged>>\fR
This is sent to a text widget when the ttk (Tile) theme changed.
This is sent to all widgets when the ttk theme changed. The ttk
widgets listen to this event and redisplay themselves when it fires.
The legacy widgets ignore this event.
.TP
\fB<<TraverseIn>>\fR
This is sent to a widget when the focus enters the widget because of a

View File

@@ -99,21 +99,25 @@ The \fBframe\fR command creates a new Tcl command whose
name is the same as the path name of the frame's window. This
command may be used to invoke various
operations on the widget. It has the following general form:
.PP
.CS
\fIpathName option \fR?\fIarg arg ...\fR?
.CE
.PP
\fIPathName\fR is the name of the command, which is the same as
the frame widget's path name. \fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
commands are possible for frame widgets:
.TP
\fIpathName \fBcget\fR \fIoption\fR
.
Returns the current value of the configuration option given
by \fIoption\fR.
\fIOption\fR may have any of the values accepted by the \fBframe\fR
command.
.TP
\fIpathName \fBconfigure\fR ?\fIoption\fR? \fI?value option value ...\fR?
.
Query or modify the configuration options of the widget.
If no \fIoption\fR is specified, returns a list describing all of
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for

View File

@@ -35,6 +35,13 @@ whether the existing file should be overwritten or not.
The following \fIoption\-value\fR pairs are possible as command line
arguments to these two commands:
.TP
\fB\-command\fR \fIstring\fR
Specifies the prefix of a Tcl command to invoke when the user closes the
dialog after having selected an item. This callback is not called if the
user cancelled the dialog. The actual command consists of \fIstring\fR
followed by a space and the value selected by the user in the dialog. This
is only available on Mac OS X.
.TP
\fB\-confirmoverwrite\fR \fIboolean\fR
Configures how the Save dialog reacts when the selected file already
exists, and saving would overwrite it. A true value requests a

View File

@@ -61,6 +61,16 @@ The \fBfocus\fR command is still used to determine which window in the
application receives the keyboard events.
The keyboard grab is released when the grab is released.
.PP
On macOS a global grab affects all windows created by one Tk process.
No window in that process other than the grab window can even be
focused, hence no other window receives key or mouse events. A local
grab on macOS affects all windows created by one Tcl interpreter. It
is possible to focus any window belonging to the Tk process during a
local grab but the grab window is the only window created by its
interpreter which receives key or mouse events. Windows belonging to the
same process but created by different interpreters continue to receive
key and mouse events normally.
.PP
Grabs apply to particular displays. If an application has windows
on multiple displays then it can establish a separate grab on each
display.

View File

@@ -160,7 +160,8 @@ This space is added outside the slave(s) border.
Insert the slave so that it occupies the \fIn\fRth row in the grid.
Row numbers start with 0. If this option is not supplied, then the
slave is arranged on the same row as the previous slave specified on this
call to \fBgrid\fR, or the first unoccupied row if this is the first slave.
call to \fBgrid\fR, or the next row after the highest occupied row
if this is the first slave.
.TP
\fB\-rowspan \fIn\fR
.
@@ -440,7 +441,7 @@ widths:
.PP
.CS
button .b \-text "Foo"
entry .e \-variable foo
entry .e \-textvariable foo ; set foo "Hello World!"
label .l \-text "This is a fairly long piece of text"
\fBgrid\fR .b .e .l \-sticky ew

File diff suppressed because it is too large Load Diff

View File

@@ -98,8 +98,10 @@ a bitmap, or an image, controlled by the \fB\-label\fR,
\fB\-bitmap\fR, and \fB\-image\fR options for the entry.
If the \fB\-accelerator\fR option is specified for an entry then a second
textual field is displayed to the right of the label. The accelerator
typically describes a keystroke sequence that may be typed in the
typically describes a keystroke sequence that may be used in the
application to cause the same result as invoking the menu entry.
This is a display option, it does not actually set the corresponding
binding (which can be achieved using the \fBbind\fR command).
The third field is an \fIindicator\fR. The indicator is present only for
checkbutton or radiobutton entries. It indicates whether the entry
is selected or not, and is displayed to the left of the entry's
@@ -262,7 +264,10 @@ contents are inserted into the standard Window menu of the user's
menubar whenever the window's menubar is in front. The first items in
the menu are provided by Mac OS X, and the names of the current
toplevels are automatically appended after all the Tk-defined items and
a separator.
a separator. The Window menu on the Mac also allows toggling the
window into a fullscreen state, and managing a tabbed window interface
(multiple windows grouped into a single window) if supported by that
version of the operating system.
.PP
When Tk sees a .menubar.help menu on the Macintosh, the menu's contents
are appended to the standard Help menu of the user's menubar whenever
@@ -465,18 +470,19 @@ a menu entry does not automatically unpost the menu; the default
bindings normally take care of this before invoking the \fBinvoke\fR
widget command.
.TP
\fIpathName \fBpost \fIx y\fR
\fIpathName \fBpost \fIx y\fR ?\fIindex\fR?
.
Arrange for the menu to be displayed on the screen at the root-window
coordinates given by \fIx\fR and \fIy\fR. These coordinates are
adjusted if necessary to guarantee that the entire menu is visible on
the screen. This command normally returns an empty string.
If the \fB\-postcommand\fR option has been specified, then its value is
executed as a Tcl script before posting the menu and the result of
that script is returned as the result of the \fBpost\fR widget
command.
If an error returns while executing the command, then the error is
returned without posting the menu.
coordinates given by \fIx\fR and \fIy\fR. If an index is specified
the menu will be located so that the entry with that index is
displayed at the point. These coordinates are adjusted if necessary to
guarantee that the entire menu is visible on the screen. This command
normally returns an empty string. If the \fB\-postcommand\fR option
has been specified, then its value is executed as a Tcl script before
posting the menu and the result of that script is returned as the
result of the \fBpost\fR widget command. If an error returns while
executing the command, then the error is returned without posting the
menu.
.TP
\fIpathName \fBpostcascade \fIindex\fR
.
@@ -537,8 +543,10 @@ This option is not available for separator or tear-off entries.
.
Specifies a string to display at the right side of the menu entry.
Normally describes an accelerator keystroke sequence that may be
typed to invoke the same function as the menu entry. This option
is not available for separator or tear-off entries.
used to invoke the same function as the menu entry. This is a display
option, it does not actually set the corresponding binding (which can
be achieved using the \fBbind\fR command). This option is not available
for separator or tear-off entries.
.TP
\fB\-background \fIvalue\fR
.

View File

@@ -24,6 +24,12 @@ buttons. Then it returns the symbolic name of the selected button.
.PP
The following option-value pairs are supported:
.TP
\fB\-command\fR \fIstring\fR
Specifies the prefix of a Tcl command to invoke when the user closes the
dialog. The actual command consists of \fIstring\fR followed by a space
and the name of the button clicked by the user to close the dialog. This
is only available on Mac OS X.
.TP
\fB\-default\fR \fIname\fR
.
\fIName\fR gives the symbolic name of the default button for

View File

@@ -29,6 +29,17 @@ drawn as squares. May be any value accepted by \fBTk_GetPixels\fR.
Specifies a desired height for the overall panedwindow widget. May be any
value accepted by \fBTk_GetPixels\fR. If an empty string, the widget will be
made high enough to allow all contained widgets to have their natural height.
.OP \-opaqueresize opaqueResize OpaqueResize
Specifies whether panes should be resized as a sash is moved (true),
or if resizing should be deferred until the sash is placed (false).
In the latter case, a
.QW ghost
version of the sash is displayed during the resizing to show where the
panes will be resized to when releasing the mouse button. This
.QW ghost
version of the sash is the proxy. It's rendering can be configured
using the \fB-proxybackground\fR, \fB-proxyborderwidth\fR and
\fB-proxyrelief\fR options.
.OP \-proxybackground proxyBackground ProxyBackground
Background color to use when drawing the proxy. If an empty string, the
value of the \fB-background\fR option will be used.
@@ -39,9 +50,6 @@ Specifies the borderwidth of the proxy. May be any value accepted by
Relief to use when drawing the proxy. May be any of the standard Tk
relief values. If an empty string, the value of the \fB-sashrelief\fR
option will be used.
.OP \-opaqueresize opaqueResize OpaqueResize
Specifies whether panes should be resized as a sash is moved (true),
or if resizing should be deferred until the sash is placed (false).
.OP \-sashcursor sashCursor SashCursor
Mouse cursor to use when over a sash. If null,
\fBsb_h_double_arrow\fR will be used for horizontal panedwindows, and
@@ -133,56 +141,6 @@ index of the sash or handle, and a word indicating whether it is over
a sash or a handle, such as {0 sash} or {2 handle}. If the point is
over any other part of the panedwindow, the result is an empty list.
.TP
\fIpathName \fBproxy \fR?\fIargs\fR?
.
This command is used to query and change the position of the sash
proxy, used for rubberband-style pane resizing. It can take any of
the following forms:
.RS
.TP
\fIpathName \fBproxy coord\fR
.
Return a list containing the x and y coordinates of the most recent
proxy location.
.TP
\fIpathName \fBproxy forget\fR
.
Remove the proxy from the display.
.TP
\fIpathName \fBproxy place \fIx y\fR
.
Place the proxy at the given \fIx\fR and \fIy\fR coordinates.
.RE
.TP
\fIpathName \fBsash \fR?\fIargs\fR?
This command is used to query and change the position of sashes in the
panedwindow. It can take any of the following forms:
.RS
.TP
\fIpathName \fBsash coord \fIindex\fR
.
Return the current x and y coordinate pair for the sash given by
\fIindex\fR. \fIIndex\fR must be an integer between 0 and 1 less than
the number of panes in the panedwindow. The coordinates given are
those of the top left corner of the region containing the sash.
.TP
\fIpathName \fBsash dragto \fIindex x y\fR
.
This command computes the difference between the given coordinates and the
coordinates given to the last \fBsash mark\fR command for the given
sash. It then moves that sash the computed difference. The return
value is the empty string.
.TP
\fIpathName \fBsash mark \fIindex x y\fR
.
Records \fIx\fR and \fIy\fR for the sash given by \fIindex\fR; used in
conjunction with later \fBsash dragto\fR commands to move the sash.
.TP
\fIpathName \fBsash place \fIindex x y\fR
.
Place the sash given by \fIindex\fR at the given coordinates.
.RE
.TP
\fIpathName \fBpanecget \fIwindow option\fR
.
Query a management option for \fIwindow\fR. \fIOption\fR may be any
@@ -310,6 +268,56 @@ panedwindow. \fISize\fR may be any value accepted by \fBTk_GetPixels\fR.
\fIpathName \fBpanes\fR
.
Returns an ordered list of the widgets managed by \fIpathName\fR.
.TP
\fIpathName \fBproxy \fR?\fIargs\fR?
.
This command is used to query and change the position of the sash
proxy, used for rubberband-style pane resizing. It can take any of
the following forms:
.RS
.TP
\fIpathName \fBproxy coord\fR
.
Return a list containing the x and y coordinates of the most recent
proxy location.
.TP
\fIpathName \fBproxy forget\fR
.
Remove the proxy from the display.
.TP
\fIpathName \fBproxy place \fIx y\fR
.
Place the proxy at the given \fIx\fR and \fIy\fR coordinates.
.RE
.TP
\fIpathName \fBsash \fR?\fIargs\fR?
This command is used to query and change the position of sashes in the
panedwindow. It can take any of the following forms:
.RS
.TP
\fIpathName \fBsash coord \fIindex\fR
.
Return the current x and y coordinate pair for the sash given by
\fIindex\fR. \fIIndex\fR must be an integer between 0 and 1 less than
the number of panes in the panedwindow. The coordinates given are
those of the top left corner of the region containing the sash.
.TP
\fIpathName \fBsash dragto \fIindex x y\fR
.
This command computes the difference between the given coordinates and the
coordinates given to the last \fBsash mark\fR command for the given
sash. It then moves that sash the computed difference. The return
value is the empty string.
.TP
\fIpathName \fBsash mark \fIindex x y\fR
.
Records \fIx\fR and \fIy\fR for the sash given by \fIindex\fR; used in
conjunction with later \fBsash dragto\fR commands to move the sash.
.TP
\fIpathName \fBsash place \fIindex x y\fR
.
Place the sash given by \fIindex\fR at the given coordinates.
.RE
.SH "RESIZING PANES"
.PP
A pane is resized by grabbing the sash (or sash handle if present) and
@@ -323,7 +331,7 @@ fill, and the containing toplevel is resized), space is added to the final
(rightmost or bottommost) pane in the window.
.PP
Unlike slave windows managed by e.g. pack or grid, the panes managed by a
panedwindow do not change width or height to accomodate changes in the
panedwindow do not change width or height to accommodate changes in the
requested widths or heights of the panes, once these have become mapped.
Therefore it may be advisable, particularly when creating layouts
interactively, to not add a pane to the panedwindow widget until after the

View File

@@ -41,16 +41,6 @@ Specifies whether or not the indicator should be drawn. Must be a
proper boolean value. If false, the \fB\-relief\fR option is
ignored and the widget's relief is always sunken if the widget is
selected and raised otherwise.
.OP \-selectcolor selectColor Background
Specifies a background color to use when the button is selected.
If \fB\-indicatoron\fR is true then the color applies to the indicator.
Under Windows, this color is used as the background for the indicator
regardless of the select state.
If \fB\-indicatoron\fR is false, this color is used as the background
for the entire widget, in place of \fB\-background\fR or \fB\-activeBackground\fR,
whenever the widget is selected.
If specified as an empty string then no special color is used for
displaying when the widget is selected.
.OP \-offrelief offRelief OffRelief
Specifies the relief for the checkbutton when the indicator is not drawn and
the checkbutton is off. The default value is
@@ -71,6 +61,15 @@ toolbar buttons, by configuring \fB\-relief flat \-overrelief
raised\fR. If the value of this option is the empty string, then no
alternative relief is used when the mouse cursor is over the radiobutton.
The empty string is the default value.
.OP \-selectcolor selectColor Background
Specifies a background color to use when the button is selected.
If \fBindicatorOn\fR is true then the color is used as the background for
the indicator regardless of the select state.
If \fB\-indicatoron\fR is false, this color is used as the background
for the entire widget, in place of \fB\-background\fR or \fB\-activeBackground\fR,
whenever the widget is selected.
If specified as an empty string then no special color is used for
displaying when the widget is selected.
.OP \-selectimage selectImage SelectImage
Specifies an image to display (in place of the \fB\-image\fR option)
when the radiobutton is selected.

View File

@@ -31,6 +31,9 @@ this could end up either raising or lowering \fIwindow\fR.
All \fBtoplevel\fR windows may be restacked with respect to each
other, whatever their relative path names, but the window manager is
not obligated to strictly honor requests to restack.
.PP
On macOS raising an iconified \fBtoplevel\fR window causes it to be
deiconified.
.SH EXAMPLE
.PP
Make a button appear to be in a sibling frame that was created after

View File

@@ -55,7 +55,7 @@ it is the scale's width.
.OP \-resolution resolution Resolution
A real value specifying the resolution for the scale.
If this value is greater than zero then the scale's value will always be
rounded to an even multiple of this value, as will tick marks and
rounded to an even multiple of this value, as will
the endpoints of the scale. If the value is less than zero then no
rounding occurs. Defaults to 1 (i.e., the value will be integral).
.OP \-showvalue showValue ShowValue
@@ -78,7 +78,7 @@ specified by the \fB\-activebackground\fR option.
.OP \-tickinterval tickInterval TickInterval
Must be a real value.
Determines the spacing between numerical
tick marks displayed below or to the left of the slider.
tick marks displayed below or to the left of the slider. The values will all be displayed with the same number of decimal places, which will be enough to ensure they are all accurate to within 20% of a tick interval.
If 0, no tick marks will be displayed.
.OP \-to to To
Specifies a real value corresponding
@@ -91,10 +91,10 @@ value.
Whenever the scale is manipulated interactively, the variable
will be modified to reflect the scale's new value.
.OP \-width width Width
Specifies the desired narrow dimension of the trough in screen units
Specifies the desired narrow dimension of the scale in screen units
(i.e. any of the forms acceptable to \fBTk_GetPixels\fR).
For vertical scales this is the trough's width; for horizontal scales
this is the trough's height.
For vertical scales this is the scale's width; for horizontal scales
this is the scale's height.
.BE
.SH DESCRIPTION
.PP

View File

@@ -140,6 +140,26 @@ If \fIcommand\fR is specified, it is a Tcl script to execute when
some other window claims ownership of the selection away from
\fIwindow\fR. \fISelection\fR defaults to PRIMARY.
.RE
.SH WIDGET FACILITIES
.PP
The \fBtext\fR, \fBentry\fR, \fBttk::entry\fR, \fBlistbox\fR, \fBspinbox\fR and \fBttk::spinbox\fR widgets have the option \fB\-exportselection\fR. If a widget has this option set to boolean \fBtrue\fR, then (in an unsafe interpreter) a selection made in the widget is automatically written to the \fBPRIMARY\fR selection.
.PP
A GUI event, for example \fB<<PasteSelection>>\fR, can copy the \fBPRIMARY\fR selection to certain widgets. This copy is implemented by a widget binding to the event. The binding script makes appropriate calls to the \fBselection\fR command.
.PP
.SH PORTABILITY ISSUES
.PP
On X11, the \fBPRIMARY\fR selection is a system-wide feature of the X server, allowing communication between different processes that are X11 clients.
.PP
On Windows, the \fBPRIMARY\fR selection is not provided by the system, but only by Tk, and so it is shared only between windows of a master interpreter and its unsafe slave interpreters. It is not shared between interpreters in different processes or different threads. Each master interpreter has a separate \fBPRIMARY\fR selection that is shared only with its unsafe slaves.
.PP
.SH SECURITY
.PP
A safe interpreter cannot read from the \fBPRIMARY\fR selection because its \fBselection\fR command is hidden. For this reason the \fBPRIMARY\fR selection cannot be written to the Tk widgets of a safe interpreter.
.PP
A Tk widget can have its option \fB\-exportselection\fR set to boolean \fBtrue\fR, but in a safe interpreter this option has no effect: writing from the widget to the \fBPRIMARY\fR selection is disabled.
.PP
These are security features. A safe interpreter may run untrusted code, and it is a security risk if this untrusted code can read or write the \fBPRIMARY\fR selection used by other interpreters.
.PP
.SH EXAMPLES
.PP
On X11 platforms, one of the standard selections available is the

View File

@@ -217,15 +217,19 @@ were editing the spinbox widget from). It is also recommended to not set an
associated \fB\-textvariable\fR during validation, as that can cause the
spinbox widget to become out of sync with the \fB\-textvariable\fR.
.PP
Also, the \fBvalidate\fR option will set itself to \fBnone\fR when the
spinbox value gets changed because of adjustment of \fBfrom\fR or \fBto\fR
and the \fBvalidateCommand\fR returns false. For instance
Also, the \fB-validate\fR option will set itself to \fBnone\fR when the
spinbox value gets changed because of adjustment of \fB-from\fR or \fB-to\fR
and the \fB-validatecommand\fR returns false. For instance
.CS
\fIspinbox pathName \-from 1 \-to 10 \-validate all \-vcmd {return 0}\fR
.CE
will in fact set the \fBvalidate\fR option to \fBnone\fR because the default
value for the spinbox gets changed (due to the \fBfrom\fR and \fBto\fR
will in fact set the \fB-validate\fR option to \fBnone\fR because the default
value for the spinbox gets changed (due to the \fB-from\fR and \fB-to\fR
options) to a value not accepted by the validation script.
.PP
Moreover, forced validation is performed when invoking any spinbutton of
the spinbox. If the validation script returns false in this situation,
then the \fB-validate\fR option will be automatically set to \fBnone\fR.
.SH "WIDGET COMMAND"
.PP
The \fBspinbox\fR command creates a new Tcl command whose

View File

@@ -491,9 +491,10 @@ second and later display lines for a text line.
\fIColor\fR specifies the background color to use in regions that do not
contain characters because they are indented by \fB\-lmargin1\fR or
\fB\-lmargin2\fR. It may have any of the forms accepted by
\fBTk_GetColor\fR.If \fIcolor\fR has not been specified, or if it is
specified as an empty string, then the color specified by the
\fB-background\fR widget option is used.
\fBTk_GetColor\fR. If \fIcolor\fR has not been specified, or if it is
specified as an empty string, then the color used is specified by the
\fB-background\fR tag option (or, if this is also unspecified, by the
\fB-background\fR widget option).
.TP
\fB\-offset \fIpixels\fR
.
@@ -536,10 +537,11 @@ character of that display line.
\fB\-rmargincolor \fIcolor\fR
.
\fIColor\fR specifies the background color to use in regions that do not
contain characters because they are indented by \fB\-rmargin1\fR. It may
have any of the forms accepted by \fBTk_GetColor\fR.If \fIcolor\fR has not
contain characters because they are indented by \fB\-rmargin\fR. It may
have any of the forms accepted by \fBTk_GetColor\fR. If \fIcolor\fR has not
been specified, or if it is specified as an empty string, then the color
specified by the \fB-background\fR widget option is used.
used is specified by the \fB-background\fR tag option (or, if this is also
unspecified, by the \fB-background\fR widget option).
.TP
\fB\-selectbackground \fIcolor\fR
\fIColor\fR specifies the background color to use when displaying selected
@@ -607,9 +609,11 @@ specified by the \fB\-foreground\fR tag option is used.
\fB\-wrap \fImode\fR
.
\fIMode\fR specifies how to handle lines that are wider than the text's
window. It has the same legal values as the \fB\-wrap\fR option for the text
widget: \fBnone\fR, \fBchar\fR, or \fBword\fR. If this tag option is
specified, it overrides the \fB\-wrap\fR option for the text widget.
window. This option only applies to a display line if it applies to the
first non-elided character on that display line. It has the same legal
values as the \fB\-wrap\fR option for the text widget: \fBnone\fR,
\fBchar\fR, or \fBword\fR. If this tag option is specified, it
overrides the \fB\-wrap\fR option for the text widget.
.PP
If a character has several tags associated with it, and if their display
options conflict, then the options of the highest priority tag are used. If a

View File

@@ -13,6 +13,8 @@
tk::mac \- Access Mac-Specific Functionality on OS X from Tk
.SH SYNOPSIS
.nf
\fB::tk::mac::DoScriptFile\fR
\fB::tk::mac::DoScriptText\fR
\fB::tk::mac::ShowPreferences\fR
\fB::tk::mac::OpenApplication\fR
\fB::tk::mac::ReopenApplication\fR
@@ -22,6 +24,9 @@ tk::mac \- Access Mac-Specific Functionality on OS X from Tk
\fB::tk::mac::OnHide\fR
\fB::tk::mac::OnShow\fR
\fB::tk::mac::ShowHelp\fR
\fB::tk::mac::PerformService\fR
\fB::tk::mac::LaunchURL \fIURL...\fR
\fB::tk::mac::GetAppPath\fR
\fB::tk::mac::standardAboutPanel\fR
@@ -30,6 +35,7 @@ tk::mac \- Access Mac-Specific Functionality on OS X from Tk
\fB::tk::mac::antialiasedtext \fInumber\fR
\fB::tk::mac::useThemedToplevel \fIboolean\fR
\fB::tk::mac::iconBitmap \fIname width height \-kind value\fR
.fi
.BE
@@ -40,6 +46,20 @@ events that applications should respond to. These events are mapped by Tk to
calls to commands in the \fB::tk::mac\fR namespace; unless otherwise noted, if
the command is absent, no action will be taken.
.TP
\fB::tk::mac::DoScriptFile\fR
.
The default Apple Event handler for AEDoScriptHandler. This command
executes a Tcl file when an AppleScript sends a
.QW "do script"
command to Wish with a file path as a parameter.
.TP
\fB::tk::mac::DoScriptText\fR
.
The default Apple Event handler for AEDoScriptHandler. This command
executes Tcl code when an AppleScript sends a
.QW "do script"
command to Wish with Tcl code or a Tcl procedure as a parameter.
.TP
\fB::tk::mac::ShowPreferences\fR
.
The default Apple Event handler for kAEShowPreferences,
@@ -61,7 +81,7 @@ proc ::tk::mac::ShowPreferences {} {
\fB::tk::mac::OpenApplication\fR
.
If a proc of this name is defined, this proc fill fire when your application
is intially opened. It is the default Apple Event handler for
is initially opened. It is the default Apple Event handler for
kAEOpenApplication,
.QW oapp .
.TP
@@ -110,9 +130,8 @@ proc ::tk::mac::OpenDocument {args} {
If a proc of this name is defined it is the default Apple Event handler for
kAEPrintDocuments,
.QW pdoc ,
the Apple Event sent when your application is asked to print one or more
documents (e.g., via the Print menu item in the Finder). It works the same
way as \fBtk::mac::OpenDocument\fR in terms of arguments.
the Apple Event sent when your application is asked to print a
document. It takes a single absolute file path as an argument.
.TP
\fB::tk::mac::Quit\fR
.
@@ -141,7 +160,57 @@ Customizes behavior of Apple Help menu; if this procedure is not defined, the
platform-specific standard Help menu item
.QW "YourApp Help"
performs the default Cocoa action of showing the Help Book configured in the
application's Info.plist (or displaying an alert if no Help Book is set).
application's Info.plist (or displaying an alert if no Help Book is
set).
.TP
\fB::tk::mac::PerformService\fR
.
Executes a Tcl procedure called from the macOS
.QW Services
menu in the Application menu item. The
.QW Services
menu item allows for inter-application communication; data from one
application, such as selected text, can be sent to another application
for processing, for example to Safari as a search item for Google, or
to TextEdit to be appended to a file. An example of the proc is below,
and should be rewritten in an application script for customization:
.RS
.PP
.CS
proc ::tk::mac::PerformService {} {
set data [clipboard get]
$w insert end $data
}
.CE
.RE
Note that the mechanism for retrieving the data is from the clipboard;
there is no other supported way to obtain the data. If the Services
process is not desired, the NSServices keys can be deleted from
the application's Info.plist file. The underlying code supporting this
command also allows the text, entry and ttk::entry widgets to access
services from other applications via the Services menu. The NSPortName
key in Wish's Info.plist file is currently set as
.QW "Wish"
; if a developer changes the name of the Wish executable to something
else, this key should be modified with the same name.
.TP
\fB::tk::mac::LaunchURL \fIURL...\fR
.
If defined, launches a URL within Tk. This would be used if a Tk
application wants to handle a URL itself, such as displaying data from
an RSS feed, rather than launching a default application to handle the
URL, although it can defined as such. Wish includes a stub URL scheme
of
.QW foo://
in the CFBundleURLSchemes key of its Info.plist file; this should be customized for the specific URL
scheme the developer wants to support.
.TP
\fB::tk::mac::GetAppPath\fR
.
Returns the current applications's file path.
.TP
.SH "ADDITIONAL DIALOGS"
.PP
The Aqua/Mac OS X defines additional dialogs that applications should

View File

@@ -104,9 +104,9 @@ to configure aspects of the toplevel such as its background color
and relief. The \fBtoplevel\fR command returns the
path name of the new window.
.PP
A toplevel is similar to a frame except that it is created as a
A toplevel is similar to a \fBframe\fR except that it is created as a
top-level window: its X parent is the root window of a screen
rather than the logical parent from its path name. The primary
rather than the logical parent from its Tk path name. The primary
purpose of a toplevel is to serve as a container for dialog boxes
and other collections of widgets. The only visible features
of a toplevel are its background color and an optional 3-D border
@@ -117,21 +117,25 @@ The \fBtoplevel\fR command creates a new Tcl command whose
name is the same as the path name of the toplevel's window. This
command may be used to invoke various
operations on the widget. It has the following general form:
.PP
.CS
\fIpathName option \fR?\fIarg arg ...\fR?
.CE
.PP
\fIPathName\fR is the name of the command, which is the same as
the toplevel widget's path name. \fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
commands are possible for toplevel widgets:
.TP
\fIpathName \fBcget \fIoption\fR
.
Returns the current value of the configuration option given
by \fIoption\fR.
\fIOption\fR may have any of the values accepted by the \fBtoplevel\fR
command.
.TP
\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
.
Query or modify the configuration options of the widget.
If no \fIoption\fR is specified, returns a list describing all of
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
@@ -148,8 +152,10 @@ command.
.PP
When a new toplevel is created, it has no default event bindings:
toplevels are not intended to be interactive.
.PP
Be aware that bindings on toplevels may receive events from subwidgets.
.SH "SEE ALSO"
frame(n)
bind(n), bindtags(n), frame(n), wm(n)
.SH KEYWORDS
toplevel, widget
'\" Local Variables:

View File

@@ -212,7 +212,7 @@ See \fBTk_GetPixelsFromObj(3)\fR for the syntax of length specifications.
.PP
\fBTtk_GetBorderFromObj\fR is the same as \fBTtk_GetPaddingFromObj\fR
except that the lengths are specified as integers
(i.e., resolution-dependant values like \fI3m\fR are not allowed).
(i.e., resolution-dependent values like \fI3m\fR are not allowed).
.PP
\fBTtk_GetStickyFromObj\fR converts the string in \fIobjPtr\fR
to a \fIsticky\fR bitmask. The string contains zero or more

View File

@@ -39,19 +39,11 @@ The default is \fBnormal\fR.
Depending on the theme, the default button may be displayed
with an extra highlight ring, or with a different border color.
.RE
.OP \-width width Width
If greater than zero, specifies how much space, in character widths,
to allocate for the text label.
If less than zero, specifies a minimum width.
If zero or unspecified, the natural width of the text label is used.
Note that some themes may specify a non-zero \fB\-width\fR
in the style.
.\" Not documented -- may go away
.\" .OP \-padding padding Padding
.\" .OP \-foreground foreground Foreground
.\" .OP \-font font Font
.\" .OP \-anchor anchor Anchor
.\" .OP \-padding padding Padding
.\" .OP \-relief relief Relief
.SH "WIDGET COMMAND"
.PP
@@ -65,13 +57,51 @@ Invokes the command associated with the button.
.PP
\fBTtk::button\fR widgets support the \fBToolbutton\fR style in all standard
themes, which is useful for creating widgets for toolbars.
.SH "COMPATIBILITY OPTIONS"
.OP \-state state State
May be set to \fBnormal\fR or \fBdisabled\fR to control the
\fBdisabled\fR state bit. This is a
.QW write-only
option: setting it changes the widget state, but the \fBstate\fR
widget command does not affect the state option.
.SH "STYLING OPTIONS"
.PP
The class name for a \fBttk::button\fP is \fBTButton\fP.
.PP
Dynamic states: \fBactive\fP, \fBdisabled\fP, \fBpressed\fP, \fBreadonly\fP.
.PP
\fBTButton\fP styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-anchor\fP \fIanchor\fP
.br
\fB\-background\fP \fIcolor\fP
.br
\fB\-bordercolor\fP \fIcolor\fP
.br
\fB\-compound\fP \fIcompound\fP
.br
\fB\-darkcolor\fP \fIcolor\fP
.br
\fB\-foreground\fP \fIcolor\fP
.br
\fB\-font\fP \fIfont\fP
.br
\fB\-highlightcolor\fP \fIcolor\fP
.br
\fB\-highlightthickness\fP \fIamount\fP
.br
\fB\-lightcolor\fP \fIcolor\fP
.br
\fB\-padding\fP \fIpadding\fP
.br
\fB\-relief\fP \fIrelief\fP
.br
\fB\-shiftrelief\fP \fIamount\fP
.RS
\fB\-shiftrelief\fP specifies how far the button contents are
shifted down and right in the \fIpressed\fP state.
This action provides additional skeumorphic feedback.
.RE
\fB\-width\fP \fIamount\fP
.PP
Some options are only available for specific themes.
.PP
See the \fBttk::style\fP manual page for information on how to configure
ttk styles.
.SH "SEE ALSO"
ttk::widget(n), button(n)
.SH "KEYWORDS"

View File

@@ -68,6 +68,36 @@ selection.)
.PP
\fBTtk::checkbutton\fR widgets support the \fBToolbutton\fR style in all
standard themes, which is useful for creating widgets for toolbars.
.SH "STYLING OPTIONS"
.PP
The class name for a \fBttk::checkbutton\fP is \fBTCheckbutton\fP.
.PP
Dynamic states: \fBactive\fP, \fBalternate\fP, \fBdisabled\fP,
\fBpressed\fP, \fBselected\fP, \fBreadonly\fP.
.PP
\fBTCheckbutton\fP styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-background\fP \fIcolor\fP
.br
\fB\-compound\fP \fIcompound\fP
.br
\fB\-foreground\fP \fIcolor\fP
.br
\fB\-indicatorbackground\fP \fIcolor\fP
.br
\fB\-indicatorcolor\fP \fIcolor\fP
.br
\fB\-indicatormargin\fP \fIpadding\fP
.br
\fB\-indicatorrelief\fP \fIrelief\fP
.br
\fB\-padding\fP \fIpadding\fP
.PP
Some options are only available for specific themes.
.PP
See the \fBttk::style\fP manual page for information on how to configure
ttk styles.
.SH "SEE ALSO"
ttk::widget(n), ttk::radiobutton(n), checkbutton(n)
.SH "KEYWORDS"

View File

@@ -67,7 +67,9 @@ The following subcommands are possible for combobox widgets:
.TP
\fIpathName \fBcurrent\fR ?\fInewIndex\fR?
If \fInewIndex\fR is supplied, sets the combobox value
to the element at position \fInewIndex\fR in the list of \fB\-values\fR.
to the element at position \fInewIndex\fR in the list of \fB\-values\fR
(in addition to integers, the \fBend\fR index is supported and indicates
the last element of the list).
Otherwise, returns the index of the current value in the list of
\fB\-values\fR or \fB\-1\fR if the current value does not appear in the list.
.TP
@@ -110,6 +112,85 @@ The combobox widget generates a \fB<<ComboboxSelected>>\fR virtual event
when the user selects an element from the list of values.
If the selection action unposts the listbox,
this event is delivered after the listbox is unposted.
.SH "STYLING OPTIONS"
.PP
The class name for a \fBttk::combobox\fP is \fBTCombobox\fP.
The \fBttk::combobox\fP uses the \fBentry\fP and
\fBlistbox\fP widgets internally.
The listbox frame has a class name of \fBComboboxPopdownFrame\fP.
.PP
Dynamic states: \fBdisabled\fP, \fBfocus\fP, \fBpressed\fP, \fBreadonly\fP.
.PP
\fBTCombobox\fP styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-arrowcolor\fP \fIcolor\fP
.br
\fB\-arrowsize\fP \fIamount\fP
.br
\fB\-background\fP \fIcolor\fP
.br
\fB\-bordercolor\fP \fIcolor\fP
.br
\fB\-darkcolor\fP \fIcolor\fP
.br
\fB\-focusfill\fP \fIcolor\fP
.br
\fB\-foreground\fP \fIcolor\fP
.br
\fB\-fieldbackground\fP \fIcolor\fP
.RS
Can only be changed when using non-native and non-graphical themes.
.RE
\fB\-insertwidth\fP \fIamount\fP
.br
\fB\-lightcolor\fP \fIcolor\fP
.br
\fB\-padding\fP \fIpadding\fP
.br
\fB\-postoffset\fP \fIpadding\fP
.br
\fB\-selectbackground\fP \fIcolor\fP
.RS
Text entry select background.
.RE
\fB\-selectforeground\fP \fIcolor\fP
.RS
Text entry select foreground.
.RE
.PP
The \fBttk::combobox\fP popdown listbox cannot be configured using
\fBttk::style\fP nor via the widget \fBconfigure\fP command. The listbox
can be configured using the option database.
.PP
option add *TCombobox*Listbox.background \fIcolor\fP
.br
option add *TCombobox*Listbox.font \fIfont\fP
.br
option add *TCombobox*Listbox.foreground \fIcolor\fP
.br
option add *TCombobox*Listbox.selectBackground \fIcolor\fP
.br
option add *TCombobox*Listbox.selectForeground \fIcolor\fP
.PP
To configure a specific listbox (subject to future change):
.CS
set popdown [ttk::combobox::PopdownWindow .mycombobox]
$popdown.f.l configure \-font \fIfont\fP
.CE
.PP
\fBComboboxPopdownFrame\fP
styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-borderwidth\fP \fIamount\fP
.br
\fB\-relief\fP \fIrelief\fP
.PP
Some options are only available for specific themes.
.PP
See the \fBttk::style\fP manual page for information on how to configure
ttk styles.
.SH "SEE ALSO"
ttk::widget(n), ttk::entry(n)
.SH KEYWORDS

View File

@@ -222,52 +222,13 @@ by the \fB\-validate\fR option.
Returns 0 if validation fails, 1 if it succeeds.
Sets or clears the \fBinvalid\fR state accordingly.
See \fBVALIDATION\fR below for more details.
.TP
\fIpathName \fBxview \fIargs\fR
This command is used to query and change the horizontal position of the
text in the widget's window. It can take any of the following
forms:
.RS
.TP
\fIpathName \fBxview\fR
Returns a list containing two elements.
Each element is a real fraction between 0 and 1; together they describe
the horizontal span that is visible in the window.
For example, if the first element is .2 and the second element is .6,
20% of the entry's text is off-screen to the left, the middle 40% is visible
in the window, and 40% of the text is off-screen to the right.
These are the same values passed to scrollbars via the \fB\-xscrollcommand\fR
option.
.TP
\fIpathName \fBxview\fR \fIindex\fR
Adjusts the view in the window so that the character given by \fIindex\fR
is displayed at the left edge of the window.
.TP
\fIpathName \fBxview moveto\fI fraction\fR
Adjusts the view in the window so that the character \fIfraction\fR of the
way through the text appears at the left edge of the window.
\fIFraction\fR must be a fraction between 0 and 1.
.TP
\fIpathName \fBxview scroll \fInumber what\fR
This command shifts the view in the window left or right according to
\fInumber\fR and \fIwhat\fR.
\fINumber\fR must be an integer.
\fIWhat\fR must be either \fBunits\fR or \fBpages\fR.
'\" or an abbreviation of one of these, but we don't document that.
If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by
\fInumber\fR average-width characters on the display; if it is
\fBpages\fR then the view adjusts by \fInumber\fR screenfuls.
If \fInumber\fR is negative then characters farther to the left
become visible; if it is positive then characters farther to the right
become visible.
.RE
.PP
The entry widget also supports the following generic \fBttk::widget\fR
widget subcommands (see \fIttk::widget(n)\fR for details):
.DS
.ta 5.5c 11c
\fBcget\fR \fBconfigure\fR \fBidentify\fR
\fBinstate\fR \fBstate\fR
\fBinstate\fR \fBstate\fR \fBxview\fR
.DE
.SH VALIDATION
.PP
@@ -461,6 +422,47 @@ and a different background is used in the \fBreadonly\fR state.
.PP
The entry widget sets the \fBinvalid\fR state if revalidation fails,
and clears it whenever validation succeeds.
.SH "STYLING OPTIONS"
.PP
The class name for a \fBttk::entry\fP is \fBTEntry\fP.
.PP
Dynamic states: \fBdisabled\fP, \fBfocus\fP, \fBreadonly\fP.
.PP
\fBTEntry\fP styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-background\fP \fIcolor\fP
.RS
For backwards compatibility, when using the aqua theme (for macOS), this
option behaves as an alias for the \fB\-fieldbackground\fP provided that no
value is specified for \fB\-fieldbackground\fP. Otherwise it is ignored.
.RE
\fB\-bordercolor\fP \fIcolor\fP
.br
\fB\-darkcolor\fP \fIcolor\fP
.br
\fB\-fieldbackground\fP \fIcolor\fP
.RS
Some themes use a graphical background and their field background colors cannot be changed.
.RE
\fB\-foreground\fP \fIcolor\fP
.br
\fB\-insertwidth\fP \fIamount\fP
.br
\fB\-lightcolor\fP \fIcolor\fP
.br
\fB\-padding\fP \fIpadding\fP
.br
\fB\-relief\fP \fIrelief\fP
.br
\fB\-selectbackground\fP \fIcolor\fP
.br
\fB\-selectborderwidth\fP \fIamount\fP
.br
\fB\-selectforeground\fP \fIcolor\fP
.PP
See the \fBttk::style\fP manual page for information on how to configure
ttk styles.
.SH "SEE ALSO"
ttk::widget(n), entry(n)
.SH KEYWORDS

View File

@@ -17,19 +17,18 @@ ttk::frame \- Simple container widget
A \fBttk::frame\fR widget is a container, used to group other widgets
together.
.SO ttk_widget
\-class \-cursor \-takefocus
\-style
\-class \-cursor \-padding \-style
\-takefocus
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-borderwidth borderWidth BorderWidth
The desired width of the widget border. Defaults to 0.
May be ignored depending on the theme used.
.OP \-relief relief Relief
One of the standard Tk border styles:
\fBflat\fR, \fBgroove\fR, \fBraised\fR, \fBridge\fR,
\fBsolid\fR, or \fBsunken\fR.
Defaults to \fBflat\fR.
.OP \-padding padding Padding
Additional padding to include inside the border.
.OP \-width width Width
If specified, the widget's requested width in pixels.
.OP \-height height Height
@@ -47,6 +46,25 @@ by the GM's requested size will normally take precedence
over the \fBframe\fR widget's \fB\-width\fR and \fB\-height\fR options.
\fBpack propagate\fR and \fBgrid propagate\fR can be used
to change this.
.SH "STYLING OPTIONS"
.PP
The class name for a \fBttk::frame\fP is \fBTFrame\fP.
.PP
\fBTFrame\fP styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-background\fP \fIcolor\fP
.br
\fB\-relief\fP \fIrelief\fP
.PP
Some options are only available for specific themes.
.PP
See the \fBttk::style\fP manual page for information on how to configure
ttk styles.
.SH BINDINGS
.PP
When a new \fBttk::frame\fR is created, it has no default event bindings;
\fBttk::frame\fRs are not intended to be interactive.
.SH "SEE ALSO"
ttk::widget(n), ttk::labelframe(n), frame(n)
.SH "KEYWORDS"

View File

@@ -29,6 +29,13 @@ Valid \fIoptions\fR are:
\fB\-border\fR \fIpadding\fR
\fIpadding\fR is a list of up to four integers, specifying
the left, top, right, and bottom borders, respectively.
If fewer than four elements are specified,
\fIbottom\fR defaults to \fItop\fR,
\fIright\fR defaults to \fIleft\fR, and
\fItop\fR defaults to \fIleft\fR.
In other words, a list of three numbers specify the left, vertical, and right border;
a list of two numbers specify the horizontal and the vertical border;
a single number specifies the same border all the way around the element.
See \fBIMAGE STRETCHING\fR, below.
.TP
\fB\-height \fIheight\fR
@@ -36,8 +43,17 @@ Specifies a minimum height for the element.
If less than zero, the base image's height is used as a default.
.TP
\fB\-padding\fR \fIpadding\fR
Specifies the element's interior padding. Defaults to
\fB\-border\fR if not specified.
Specifies the element's interior padding.
The padding is a list of up to four length specifications
\fIleft top right bottom\fR.
If fewer than four elements are specified,
\fIbottom\fR defaults to \fItop\fR,
\fIright\fR defaults to \fIleft\fR, and
\fItop\fR defaults to \fIleft\fR.
In other words, a list of three numbers specify the left, vertical, and right padding;
a list of two numbers specify the horizontal and the vertical padding;
a single number specifies the same padding all the way around the widget.
Defaults to \fB\-border\fR if not specified.
.TP
\fB\-sticky\fR \fIspec\fR
Specifies how the image is placed within the final parcel.

View File

@@ -13,7 +13,7 @@ ttk::intro \- Introduction to the Tk theme engine
.SH "OVERVIEW"
.PP
The Tk themed widget set is based on a revised and enhanced version
of TIP #48 (http://tip.tcl.tk/48) specified style engine.
of TIP #48 (https://tip.tcl-lang.org/48) specified style engine.
The main concepts are described below.
The basic idea is to separate, to the extent possible,
the code implementing a widget's behavior from

View File

@@ -19,7 +19,7 @@ The label may be linked to a Tcl variable
to automatically change the displayed text.
.SO ttk_widget
\-class \-compound \-cursor
\-image \-style \-takefocus
\-image \-padding \-state \-style \-takefocus
\-text \-textvariable \-underline
\-width
.SE
@@ -43,23 +43,12 @@ If there are multiple lines of text, specifies how
the lines are laid out relative to one another.
One of \fBleft\fR, \fBcenter\fR, or \fBright\fR.
See also \fB\-anchor\fR.
.OP \-padding padding Padding
Specifies the amount of extra space to allocate for the widget.
The padding is a list of up to four length specifications
\fIleft top right bottom\fR.
If fewer than four elements are specified,
\fIbottom\fR defaults to \fItop\fR,
\fIright\fR defaults to \fIleft\fR, and
\fItop\fR defaults to \fIleft\fR.
.OP \-relief relief Relief
.\" Rewrite this:
Specifies the 3-D effect desired for the widget border.
Valid values are
\fBflat\fR, \fBgroove\fR, \fBraised\fR, \fBridge\fR, \fBsolid\fR,
and \fBsunken\fR.
.OP \-text text Text
Specifies a text string to be displayed inside the widget
(unless overridden by \fB\-textvariable\fR).
.OP \-wraplength wrapLength WrapLength
Specifies the maximum line length (in pixels).
If this option is less than or equal to zero,
@@ -71,6 +60,27 @@ than the specified value.
Supports the standard widget commands
\fBconfigure\fR, \fBcget\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR;
see \fIttk::widget(n)\fR.
.SH "STYLING OPTIONS"
.PP
The class name for a \fBttk::label\fP is \fBTLabel\fP.
.PP
Dynamic states: \fBdisabled\fP, \fBreadonly\fP.
.PP
\fBTLabel\fP styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-background\fP \fIcolor\fP
.br
\fB\-compound\fP \fIcompound\fP
.br
\fB\-foreground\fP \fIcolor\fP
.br
\fB\-font\fP \fIfont\fP
.PP
Some options are only available for specific themes.
.PP
See the \fBttk::style\fP manual page for information on how to configure
ttk styles.
.SH "SEE ALSO"
ttk::widget(n), label(n)
'\" Local Variables:

View File

@@ -18,8 +18,8 @@ A \fBttk::labelframe\fR widget is a container used to group other widgets
together. It has an optional label, which may be a plain text string or
another widget.
.SO ttk_widget
\-class \-cursor \-takefocus
\-style
\-class \-cursor \-padding \-style
\-takefocus
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
.\" XXX: Currently included, but may go away:
@@ -30,6 +30,10 @@ another widget.
.\" XXX: \fBflat\fR, \fBgroove\fR, \fBraised\fR, \fBridge\fR,
.\" XXX: \fBsolid\fR, or \fBsunken\fR.
.\" XXX: Default is theme-dependent.
.OP \-height height Height
If specified, the widget's requested height in pixels.
(See \fIttk::frame(n)\fR for further notes on \fB\-width\fR and
\fB\-height\fR).
.OP \-labelanchor labelAnchor LabelAnchor
Specifies where to place the label.
Allowed values are (clockwise from the top upper left corner):
@@ -40,6 +44,12 @@ The default value is theme-dependent.
.\" and specifies which side the label should be placed on;
.\" the remaining characters specify how the label is aligned on that side.
.\" NOTE: Now allows other values as well; leave this undocumented for now
.OP \-labelwidget labelWidget LabelWidget
The name of a widget to use for the label.
If set, overrides the \fB\-text\fR option.
The \fB\-labelwidget\fR must be a child of the \fBlabelframe\fR widget
or one of the \fBlabelframe\fR's ancestors, and must belong to the
same top-level widget as the \fBlabelframe\fR.
.OP \-text text Text
Specifies the text of the label.
.OP \-underline underline Underline
@@ -48,25 +58,53 @@ underline in the text string.
The underlined character is used for mnemonic activation.
Mnemonic activation for a \fBttk::labelframe\fR
sets the keyboard focus to the first child of the \fBttk::labelframe\fR widget.
.OP \-padding padding Padding
Additional padding to include inside the border.
.OP \-labelwidget labelWidget LabelWidget
The name of a widget to use for the label.
If set, overrides the \fB\-text\fR option.
The \fB\-labelwidget\fR must be a child of the \fBlabelframe\fR widget
or one of the \fBlabelframe\fR's ancestors, and must belong to the
same top-level widget as the \fBlabelframe\fR.
.OP \-width width Width
If specified, the widget's requested width in pixels.
.OP \-height height Height
If specified, the widget's requested height in pixels.
(See \fIttk::frame(n)\fR for further notes on \fB\-width\fR and
\fB\-height\fR).
.SH "WIDGET COMMAND"
.PP
Supports the standard widget commands
\fBconfigure\fR, \fBcget\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR;
see \fIttk::widget(n)\fR.
.SH "STYLING OPTIONS"
.PP
The class name for a \fBttk::labelframe\fP is \fBTLabelframe\fP.
The text label
has a class of \fBTLabelframe.Label\fP.
.PP
Dynamic states: \fBdisabled\fP, \fBreadonly\fP.
.PP
\fBTLabelframe\fP styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-background\fP \fIcolor\fP
.br
\fB\-bordercolor\fP \fIcolor\fP
.br
\fB\-borderwidth\fP \fIamount\fP
.br
\fB\-darkcolor\fP \fIcolor\fP
.br
\fB\-labelmargins\fP \fIamount\fP
.br
\fB\-labeloutside\fP \fIboolean\fP
.br
\fB\-lightcolor\fP \fIcolor\fP
.br
\fB\-relief\fP \fIrelief\fP
.PP
\fBTLabelframe.Label\fP styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-background\fP \fIcolor\fP
.br
\fB\-font\fP \fIfont\fP
.br
\fB\-foreground\fP \fIcolor\fP
.PP
Some options are only available for specific themes.
.PP
See the \fBttk::style\fP manual page for information on how to configure
ttk styles.
.SH "SEE ALSO"
ttk::widget(n), ttk::frame(n), labelframe(n)
.SH "KEYWORDS"

View File

@@ -45,6 +45,35 @@ methods. No other widget methods are used.
.PP
\fBTtk::menubutton\fR widgets support the \fBToolbutton\fR style in all
standard themes, which is useful for creating widgets for toolbars.
.SH "STYLING OPTIONS"
.PP
The class name for a \fBttk::menubutton\fP is \fBTMenubutton\fP.
.PP
Dynamic states: \fBactive\fP, \fBdisabled\fP, \fBreadonly\fP.
.PP
\fBTMenubutton\fP styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-arrowsize\fP \fIamount\fP
.br
\fB\-background\fP \fIcolor\fP
.br
\fB\-compound\fP \fIcompound\fP
.br
\fB\-foreground\fP \fIcolor\fP
.br
\fB\-font\fP \fIfont\fP
.br
\fB\-padding\fP \fIpadding\fP
.br
\fB\-relief\fP \fIrelief\fP
.br
\fB\-width\fP \fIamount\fP
.PP
Some options are only available for specific themes.
.PP
See the \fBttk::style\fP manual page for information on how to configure
ttk styles.
.SH "SEE ALSO"
ttk::widget(n), menu(n), menubutton(n)
.SH "KEYWORDS"

View File

@@ -41,6 +41,9 @@ If fewer than four elements are specified,
\fIbottom\fR defaults to \fItop\fR,
\fIright\fR defaults to \fIleft\fR, and
\fItop\fR defaults to \fIleft\fR.
In other words, a list of three numbers specify the left, vertical, and right padding;
a list of two numbers specify the horizontal and the vertical padding;
a single number specifies the same padding all the way around the widget.
.OP \-width width Width
If present and greater than zero,
specifies the desired width of the pane area
@@ -171,7 +174,8 @@ Otherwise, sets the \fI\-option\fRs to the corresponding \fIvalue\fRs.
See \fBTAB OPTIONS\fR for the available options.
.TP
\fIpathname \fBtabs\fR
Returns the list of windows managed by the notebook.
Returns the list of windows managed by the notebook, in the index order of
their associated tabs.
.SH "KEYBOARD TRAVERSAL"
To enable keyboard traversal for a toplevel window
containing a notebook widget \fI$nb\fR, call:
@@ -204,6 +208,58 @@ pack [\fBttk::notebook\fR .nb]
\&.nb select .nb.f2
ttk::notebook::enableTraversal .nb
.CE
.SH "STYLING OPTIONS"
.PP
The class name for a \fBttk::notebook\fP is \fBTNotebook\fP. The tab has
a class name of \fBTNotebook.Tab\fP
.PP
Dynamic states: \fBactive\fP, \fBdisabled\fP, \fBselected\fP.
.PP
\fBTNotebook\fP styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-background\fP \fIcolor\fP
.br
\fB\-bordercolor\fP \fIcolor\fP
.br
\fB\-darkcolor\fP \fIcolor\fP
.br
\fB\-foreground\fP \fIcolor\fP
.br
\fB\-lightcolor\fP \fIcolor\fP
.br
\fB\-padding\fP \fIpadding\fP
.br
\fB\-tabmargins\fP \fIpadding\fP
.br
\fB\-tabposition\fP \fIside\fP
.br
.PP
\fBTNotebook.Tab\fP styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-background\fP \fIcolor\fP
.br
\fB\-bordercolor\fP \fIcolor\fP
.br
\fB\-compound\fP \fIcompound\fP
.br
\fB\-expand\fP \fIpadding\fP
.RS
Defines how much the tab grows in size. Usually used with the
\fBselected\fP dynamic state. \fB\-tabmargins\fP should be
set appropriately so that there is room for the tab growth.
.RE
\fB\-font\fP \fIfont\fP
.br
\fB\-foreground\fP \fIcolor\fP
.br
\fB\-padding\fP \fIpadding\fP
.PP
Some options are only available for specific themes.
.PP
See the \fBttk::style\fP manual page for information on how to configure
ttk styles.
.SH "SEE ALSO"
ttk::widget(n), grid(n)
.SH "KEYWORDS"

View File

@@ -91,7 +91,8 @@ If one \fI\-option\fR is specified, returns the value of that \fIoption\fR.
Otherwise, sets the \fI\-option\fRs to the corresponding \fIvalue\fRs.
.TP
\fIpathname \fBpanes\fR
Returns the list of all windows managed by the widget.
Returns the list of all windows managed by the widget, in the index order of
their associated panes.
.TP
\fIpathname \fBsashpos \fIindex\fR ?\fInewpos\fR?
If \fInewpos\fR is specified, sets the position
@@ -105,12 +106,55 @@ and the total size of the widget.
.\" depending on which changed most recently.
Returns the new position of sash number \fIindex\fR.
.\" Full story: new position may be different than the requested position.
.PP
The panedwindow widget also supports the following generic \fBttk::widget\fR
widget subcommands (see \fIttk::widget(n)\fR for details):
.DS
.ta 5.5c 11c
\fBcget\fR \fBconfigure\fR
\fBinstate\fR \fBstate\fR
.DE
.SH "VIRTUAL EVENTS"
.PP
The panedwindow widget generates an \fB<<EnteredChild>>\fR virtual event on
LeaveNotify/NotifyInferior events, because Tk does not execute binding scripts
for <Leave> events when the pointer crosses from a parent to a child. The
panedwindow widget needs to know when that happens.
.SH "STYLING OPTIONS"
.PP
The class name for a \fBttk::panedwindow\fP is \fBTPanedwindow\fP. The
sash has a class name of \fBSash\fP.
.PP
\fBTPanedwindow\fP styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-background\fP \fIcolor\fP
.PP
\fBSash\fP styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-background\fP \fIcolor\fP
.br
\fB\-bordercolor\fP \fIcolor\fP
.br
\fB\-gripcount\fP \fIcount\fP
.br
\fB\-handlepad\fP \fIamount\fP
.br
\fB\-handlesize\fP \fIamount\fP
.br
\fB\-lightcolor\fP \fIcolor\fP
.br
\fB\-sashpad\fP \fIamount\fP
.br
\fB\-sashrelief\fP \fIrelief\fP
.br
\fB\-sashthickness\fP \fIamount\fP
.PP
Some options are only available for specific themes.
.PP
See the \fBttk::style\fP manual page for information on how to configure
ttk styles.
.SH "SEE ALSO"
ttk::widget(n), ttk::notebook(n), panedwindow(n)
'\" Local Variables:

View File

@@ -24,29 +24,17 @@ that something is happening.
\-style
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-orient orient Orient
One of \fBhorizontal\fR or \fBvertical\fR.
Specifies the orientation of the progress bar.
.OP \-length length Length
Specifies the length of the long axis of the progress bar
(width if horizontal, height if vertical).
.OP \-mode mode Mode
One of \fBdeterminate\fR or \fBindeterminate\fR.
.OP \-maximum maximum Maximum
A floating point number specifying the maximum \fB\-value\fR.
Defaults to 100.
.OP \-value value Value
The current value of the progress bar.
In \fIdeterminate\fR mode, this represents the amount of work completed.
In \fIindeterminate\fR mode, it is interpreted modulo \fB\-maximum\fR;
that is, the progress bar completes one
.QW cycle
when the \fB\-value\fR increases by \fB\-maximum\fR.
.OP \-variable variable Variable
The name of a global Tcl variable which is linked to the \fB\-value\fR.
If specified, the \fB\-value\fR of the progress bar is
automatically set to the value of the variable whenever
the latter is modified.
.OP \-mode mode Mode
One of \fBdeterminate\fR or \fBindeterminate\fR.
.OP \-orient orient Orient
One of \fBhorizontal\fR or \fBvertical\fR.
Specifies the orientation of the progress bar.
.OP \-phase phase Phase
Read-only option.
The widget periodically increments the value of this option
@@ -54,6 +42,20 @@ whenever the \fB\-value\fR is greater than 0 and,
in \fIdeterminate\fR mode, less than \fB\-maximum\fR.
This option may be used by the current theme
to provide additional animation effects.
.OP \-value value Value
The current value of the progress bar.
In \fIdeterminate\fR mode, this represents the amount of work completed.
In \fIindeterminate\fR mode, it is interpreted modulo \fB\-maximum\fR;
that is, the progress bar completes one
.QW cycle
when the \fB\-value\fR increases by \fB\-maximum\fR.
If \fB\-variable\fR is set to an existing variable, specifying \fB\-value\fR
has no effect (the variable value takes precedence).
.OP \-variable variable Variable
The name of a global Tcl variable which is linked to the \fB\-value\fR.
If specified to an existing variable, the \fB\-value\fR of the progress bar is
automatically set to the value of the variable whenever
the latter is modified.
.SH "WIDGET COMMAND"
.PP
.TP
@@ -86,6 +88,35 @@ Increments the \fB\-value\fR by \fIamount\fR.
\fIpathName \fBstop\fR
Stop autoincrement mode:
cancels any recurring timer event initiated by \fIpathName \fBstart\fR.
.SH "STYLING OPTIONS"
.PP
The class name for a \fBttk::progressbar\fP is \fBTProgressbar\fP.
.PP
\fBTProgressbar\fP styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-background\fP \fIcolor\fP
.br
\fB\-bordercolor\fP \fIcolor\fP
.br
\fB\-darkcolor\fP \fIcolor\fP
.br
\fB\-lightcolor\fP \fIcolor\fP
.br
\fB\-maxphase\fP
.RS
For the aqua theme.
.RE
\fB\-period\fP
.RS
For the aqua theme.
.RE
\fB\-troughcolor\fP \fIcolor\fP
.PP
Some options are only available for specific themes.
.PP
See the \fBttk::style\fP manual page for information on how to configure
ttk styles.
.SH "SEE ALSO"
ttk::widget(n)
'\" Local Variables:

View File

@@ -65,6 +65,36 @@ selection.)
.PP
\fBTtk::radiobutton\fR widgets support the \fBToolbutton\fR style in all
standard themes, which is useful for creating widgets for toolbars.
.SH "STYLING OPTIONS"
.PP
The class name for a \fBttk::radiobutton\fP is \fBTRadiobutton\fP.
.PP
Dynamic states: \fBactive\fP, \fBalternate\fP, \fBdisabled\fP,
\fBpressed\fP, \fBreadonly\fP, \fBselected\fP.
.PP
\fBTRadiobutton\fP styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-background\fP \fIcolor\fP
.br
\fB\-compound\fP \fIcompound\fP
.br
\fB\-foreground\fP \fIcolor\fP
.br
\fB\-indicatorbackground\fP \fIcolor\fP
.br
\fB\-indicatorcolor\fP \fIcolor\fP
.br
\fB\-indicatormargin\fP \fIpadding\fP
.br
\fB\-indicatorrelief\fP \fIrelief\fP
.br
\fB\-padding\fP \fIpadding\fP
.PP
Some options are only available for specific themes.
.PP
See the \fBttk::style\fP manual page for information on how to configure
ttk styles.
.SH "SEE ALSO"
ttk::widget(n), ttk::checkbutton(n), radiobutton(n)
.SH "KEYWORDS"

View File

@@ -42,6 +42,8 @@ Specifies a real value corresponding to the right or bottom end of the scale.
This value may be either less than or greater than the \fB\-from\fR option.
.OP \-value value Value
Specifies the current floating-point value of the variable.
If \fB\-variable\fR is set to an existing variable, specifying \fB\-value\fR
has no effect (the variable value takes precedence).
.OP \-variable variable Variable
Specifies the name of a global variable to link to the scale. Whenever the
value of the variable changes, the scale will update to reflect this value.
@@ -91,6 +93,35 @@ Modify or query the widget state; see \fIttk::widget(n)\fR.
Get the coordinates corresponding to \fIvalue\fR, or the coordinates
corresponding to the current value of the \fB\-value\fR option if \fIvalue\fR
is omitted.
.SH "STYLING OPTIONS"
.PP
The class name for a \fBttk::scale\fP is \fBTScale\fP.
.PP
Dynamic states: \fBactive\fP.
.PP
\fBTProgressbar\fP styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-background\fP \fIcolor\fP
.br
\fB\-borderwidth\fP \fIamount\fP
.br
\fB\-darkcolor\fP \fIcolor\fP
.br
\fB\-groovewidth\fP \fIamount\fP
.br
\fB\-lightcolor\fP \fIcolor\fP
.br
\fB\-sliderwidth\fP \fIamount\fP
.br
\fB\-troughcolor\fP \fIcolor\fP
.br
\fB\-troughrelief\fP \fIrelief\fP
.PP
Some options are only available for specific themes.
.PP
See the \fBttk::style\fP manual page for information on how to configure
ttk styles.
.SH "SEE ALSO"
ttk::widget(n), scale(n)
.SH KEYWORDS

View File

@@ -76,7 +76,7 @@ Modify or query the widget state; see \fIttk::widget(n)\fR.
.SH "INTERNAL COMMANDS"
.PP
The following widget commands are used internally
by the TScrollbar widget class bindings.
by the \fBTScrollbar\fP widget class bindings.
.TP
\fIpathName \fBdelta \fIdeltaX deltaY\fR
Returns a real number indicating the fractional change in
@@ -153,7 +153,40 @@ grid $f.vsb \-row 0 \-column 1 \-sticky nsew
grid $f.hsb \-row 1 \-column 0 \-sticky nsew
grid columnconfigure $f 0 \-weight 1
grid rowconfigure $f 0 \-weight 1
pack $f
.CE
.SH "STYLING OPTIONS"
.PP
The class name for a \fBttk::scrollbar\fP is \fBTScrollbar\fP.
.PP
Dynamic states: \fBactive\fP, \fBdisabled\fP.
.PP
\fBTScrollbar\fP (or more specifically \fBVertical.TScrollbar\fP and
\fBHorizontal.TScrollbar\fP) styling options that are configurable with
\fBttk::style\fP are:
.PP
\fB\-arrowcolor\fP \fIcolor\fP
.br
\fB\-arrowsize\fP \fIamount\fP
.br
\fB\-background\fP \fIcolor\fP
.br
\fB\-bordercolor\fP \fIcolor\fP
.br
\fB\-darkcolor\fP \fIcolor\fP (color of the dark part of the 3D relief)
.br
\fB\-foreground\fP \fIcolor\fP
.br
\fB\-gripcount\fP \fIcount\fP (number of lines on the thumb)
.br
\fB\-lightcolor\fP \fIcolor\fP (color of the light part of the 3D relief)
.br
\fB\-troughcolor\fP \fIcolor\fP
.PP
Some options are only available for specific themes.
.PP
See the \fBttk::style\fP manual page for information on how to configure
ttk styles.
.SH "SEE ALSO"
ttk::widget(n), scrollbar(n)
.SH KEYWORDS

View File

@@ -17,7 +17,7 @@ ttk::separator \- Separator bar
A \fBttk::separator\fR widget displays a horizontal or vertical separator
bar.
.SO ttk_widget
\-class \-cursor \-state
\-class \-cursor
\-style \-takefocus
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
@@ -29,6 +29,20 @@ Specifies the orientation of the separator.
Separator widgets support the standard
\fBcget\fR, \fBconfigure\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR
methods. No other widget methods are used.
.PP
.SH "STYLING OPTIONS"
.PP
The class name for a \fBttk::separator\fP is \fBTSeparator\fP.
.PP
\fBTSeparator\fP styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-background\fP \fIcolor\fP
.PP
Some options are only available for specific themes.
.PP
See the \fBttk::style\fP manual page for information on how to configure
ttk styles.
.SH "SEE ALSO"
ttk::widget(n)
.SH "KEYWORDS"

View File

@@ -3,7 +3,7 @@
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\"
.TH ttk::sizegrip n 8.5 Tk "Tk Themed Widget"
.so man.macros
.BS
@@ -18,7 +18,7 @@ A \fBttk::sizegrip\fR widget (also known as a \fIgrow box\fR)
allows the user to resize the containing toplevel window
by pressing and dragging the grip.
.SO ttk_widget
\-class \-cursor \-state
\-class \-cursor
\-style \-takefocus
.SE
.SH "WIDGET COMMAND"
@@ -60,6 +60,19 @@ the sizegrip widget will not resize the window.
\fBttk::sizegrip\fR widgets only support
.QW southeast
resizing.
.SH "STYLING OPTIONS"
.PP
The class name for a \fBttk::sizegrip\fP is \fBTSizegrip\fP.
.PP
\fBTSizegrip\fP styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-background\fP \fIcolor\fP
.PP
Some options are only available for specific themes.
.PP
See the \fBttk::style\fP manual page for information on how to configure
ttk styles.
.SH "SEE ALSO"
ttk::widget(n)
.SH "KEYWORDS"

View File

@@ -21,25 +21,32 @@ of the \fBttk::entry\fR widget including support of the
\fB\-textvariable\fR option to link the value displayed by the widget
to a Tcl variable.
.SO ttk_widget
\-class \-cursor \-style
\-class \-cursor \-state \-style
\-takefocus \-xscrollcommand
.SE
.SO ttk_entry
\-validate \-validatecommand
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-command command Command
Specifies a Tcl command to be invoked whenever a spinbutton is invoked.
.OP \-format format Format
Specifies an alternate format to use when setting the string value
when using the \fB\-from\fR and \fB\-to\fR range.
This must be a format specifier of the form \fB%<pad>.<pad>f\fR,
as it will format a floating-point number.
.OP \-from from From
A floating\-point value specifying the lowest value for the spinbox. This is
used in conjunction with \fB\-to\fR and \fB\-increment\fR to set a numerical
range.
.OP \-to to To
A floating\-point value specifying the highest permissible value for the
widget. See also \fB\-from\fR and \fB\-increment\fR.
range.
.OP \-increment increment Increment
A floating\-point value specifying the change in value to be applied each
time one of the widget spin buttons is pressed. The up button applies a
positive increment, the down button applies a negative increment.
.OP \-to to To
A floating\-point value specifying the highest permissible value for the
widget. See also \fB\-from\fR and \fB\-increment\fR.
range.
.OP \-values values Values
This must be a Tcl list of values. If this option is set then this will
override any range set using the \fB\-from\fR, \fB\-to\fR and
@@ -48,13 +55,6 @@ specified beginning with the first value.
.OP \-wrap wrap Wrap
Must be a proper boolean value. If on, the spinbox will wrap around the
values of data in the widget.
.OP \-format format Format
Specifies an alternate format to use when setting the string value
when using the \fB\-from\fR and \fB\-to\fR range.
This must be a format specifier of the form \fB%<pad>.<pad>f\fR,
as it will format a floating-point number.
.OP \-command command Command
Specifies a Tcl command to be invoked whenever a spinbutton is invoked.
.SH "INDICES"
.PP
See the \fBttk::entry\fR manual for information about indexing characters.
@@ -67,8 +67,6 @@ See the \fBttk::entry\fR manual for information about using the
The following subcommands are possible for spinbox widgets in addition to
the commands described for the \fBttk::entry\fR widget:
.TP
\fIpathName \fBcurrent \fIindex\fR
.TP
\fIpathName \fBget\fR
Returns the spinbox's current value.
.TP
@@ -82,6 +80,45 @@ is set directly.
The spinbox widget generates a \fB<<Increment>>\fR virtual event when
the user presses <Up>, and a \fB<<Decrement>>\fR virtual event when the
user presses <Down>.
.SH "STYLING OPTIONS"
.PP
The class name for a \fBttk::spinbox\fP is \fBTSpinbox\fP.
.PP
Dynamic states: \fBactive\fP, \fBdisabled\fP, \fBfocus\fP, \fBreadonly\fP.
.PP
\fBTSpinbox\fP styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-arrowcolor\fP \fIcolor\fP
.br
\fB\-arrowsize\fP \fIamount\fP
.br
\fB\-background\fP \fIcolor\fP
.RS
For backwards compatibility, when using the aqua theme (for macOS), this
option behaves as an alias for the \fB\-fieldbackground\fP provided that no
value is specified for \fB\-fieldbackground\fP. Otherwise it is ignored.
.RE
\fB\-bordercolor\fP \fIcolor\fP
.br
\fB\-darkcolor\fP \fIcolor\fP
.br
\fB\-fieldbackground\fP \fIcolor\fP
.br
\fB\-foreground\fP \fIcolor\fP
.br
\fB\-lightcolor\fP \fIcolor\fP
.br
\fB\-padding\fP \fIpadding\fP
.br
\fB\-selectbackground\fP \fIcolor\fP
.br
\fB\-selectforeground\fP \fIcolor\fP
.PP
Some options are only available for specific themes.
.PP
See the \fBttk::style\fP manual page for information on how to configure
ttk styles.
.SH "SEE ALSO"
ttk::widget(n), ttk::entry(n), spinbox(n)
.SH KEYWORDS

View File

@@ -15,7 +15,7 @@ ttk::style \- Manipulate style database
.SH NOTES
.PP
See also the Tcl'2004 conference presentation,
available at http://tktable.sourceforge.net/tile/tile-tcl2004.pdf
available at https://tktable.sourceforge.net/tile/tile-tcl2004.pdf
.SH DEFINITIONS
.PP
Each widget is assigned a \fIstyle\fR,

View File

@@ -45,6 +45,7 @@ and [\fBxy\fR]\fBview\fR widget commands.
.SO ttk_widget
\-class \-cursor \-takefocus
\-style \-xscrollcommand \-yscrollcommand
\-padding
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-columns columns Columns
@@ -63,10 +64,6 @@ all columns are shown in the order given.
Specifies the number of rows which should be visible.
Note:
the requested width is determined from the sum of the column widths.
.OP \-padding padding Padding
Specifies the internal padding for the widget.
The padding is a list of up to four length specifications;
see \fBTtk_GetPaddingFromObj()\fR for details.
.OP \-selectmode selectMode SelectMode
Controls how the built-in class bindings manage the selection.
One of \fBextended\fR, \fBbrowse\fR, or \fBnone\fR.
@@ -136,25 +133,29 @@ The column name. This is a read-only option.
For example, [\fI$pathname \fBcolumn #\fIn \fB\-id\fR]
returns the data column associated with display column #\fIn\fR.
.TP
\fB\-anchor\fR
\fB\-anchor \fIanchor\fR
Specifies how the text in this column should be aligned
with respect to the cell. One of
with respect to the cell. \fIAnchor\fR is one of
\fBn\fR, \fBne\fR, \fBe\fR, \fBse\fR,
\fBs\fR, \fBsw\fR, \fBw\fR, \fBnw\fR, or \fBcenter\fR.
.TP
\fB\-minwidth\fR
\fB\-minwidth \fIminwidth\fR
The minimum width of the column in pixels.
The treeview widget will not make the column any smaller than
\fB\-minwidth\fR when the widget is resized or the user drags a
column separator. Default is 20 pixels.
.TP
\fB\-stretch \fIboolean\fR
Specifies whether or not the column width should be adjusted
when the widget is resized or the user drags a column separator.
\fIBoolean\fR may have any of the forms accepted by \fBTcl_GetBoolean\fR.
By default columns are stretchable.
.TP
\fB\-width \fIwidth\fR
The width of the column in pixels. Default is 200 pixels. The specified
column width may be changed by Tk in order to honor \fB\-stretch\fR
and/or \fB\-minwidth\fR, or when the widget is resized or the user drags a
column separator.
.TP
\fB\-stretch\fR
Specifies whether or not the column's width should be adjusted
when the widget is resized.
.TP
\fB\-width \fIw\fR
The width of the column in pixels. Default is something reasonable,
probably 200 or so.
.PP
Use \fIpathname column #0\fR to configure the tree column.
.RE
@@ -234,7 +235,7 @@ A data cell.
Returns the item ID of the item at position \fIy\fR.
.TP
\fIpathname \fBidentify column \fIx y\fR
Returns the data column identifier of the cell at position \fIx\fR.
Returns the display column identifier of the cell at position \fIx\fR.
The tree column has ID \fB#0\fR.
.TP
\fIpathname \fBidentify element \fIx y\fR
@@ -391,12 +392,13 @@ If \fIitems\fR is omitted, removes \fItag\fR from each item in the tree.
If \fItag\fR is not present for a particular item,
then the \fB\-tags\fR for that item are unchanged.
.RE
.TP
\fIpathName \fBxview \fIargs\fR
Standard command for horizontal scrolling; see \fIwidget(n)\fR.
.TP
\fIpathName \fByview \fIargs\fR
Standard command for vertical scrolling; see \fIttk::widget(n)\fR.
.PP
The treeview widget also supports the following generic \fBttk::widget\fR
widget subcommands (see \fIttk::widget(n)\fR for details):
.DS
.ta 5.5c 11c
\fBxview\fR \fByview\fR
.DE
.SH "ITEM OPTIONS"
.PP
The following item options may be specified for items
@@ -437,6 +439,9 @@ Specifies the font to use when drawing text.
Specifies the item image, in case the item's \fB\-image\fR option is empty.
.\" .PP
.\" \fI(@@@ TODO: sort out order of precedence for options)\fR
.PP
Tag priority is decided by the creation order: tags created first receive
higher priority.
.SH "COLUMN IDENTIFIERS"
.PP
Column identifiers take any of the following forms:
@@ -477,6 +482,72 @@ to determine the affected item or items.
'\" Not yet:
'\" In Tk 8.5, the affected item is also passed as the \fB\-detail\fR field
'\" of the virtual event.
.SH "STYLING OPTIONS"
.PP
The class name for a \fBttk::treeview\fP is \fBTreeview\fP.
The treeview header class name is \fBHeading\fP.
The treeview item class name is \fBItem\fP.
The treeview cell class name is \fBCell\fP.
.PP
Dynamic states: \fBdisabled\fP, \fBselected\fP.
.PP
\fBTreeview\fP styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-background\fP \fIcolor\fP
.br
\fB\-fieldbackground\fP \fIcolor\fP
.br
\fB\-font\fP \fIfont\fP
.br
\fB\-foreground\fP \fIcolor\fP
.br
\fB\-rowheight\fP \fIamount\fP
.RS
The \fB\-rowheight\fP value is not corrected by the \fBtk scaling\fP
value or by the configured font size and must always be set. Also make
sure that the \fB\-rowheight\fP is large enough to contain any images.
.PP
To adjust the \fB\-rowheight\fP for the Treeview style, use the following code
after \fBtk scaling\fP has been applied.
Note that even if you do not support or change \fBtk scaling\fP
in your program, your users may have it set in their .wishrc.
.RE
.PP
.CS
ttk::style configure Treeview \\
\-rowheight [expr {[font metrics \fIfont\fP \-linespace] + 2}]
.CE
.PP
\fBHeading\fP styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-background\fP \fIcolor\fP
.br
\fB\-font\fP \fIfont\fP
.br
\fB\-relief\fP \fIrelief\fP
.PP
\fBItem\fP styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-foreground\fP \fIcolor\fP
.br
\fB\-indicatormargins\fP \fIpadding\fP
.br
\fB\-indicatorsize\fP \fIamount\fP
.br
\fB\-padding\fP \fIpadding\fP
.PP
\fBCell\fP styling options configurable with \fBttk::style\fP
are:
.PP
\fB\-padding\fP \fIpadding\fP
.PP
Some options are only available for specific themes.
.PP
See the \fBttk::style\fP manual page for information on how to configure
ttk styles.
.SH "SEE ALSO"
ttk::widget(n), listbox(n), image(n), bind(n)
'\" Local Variables:

View File

@@ -34,6 +34,13 @@ Valid \fIoptions\fR are:
Specify the element's interior padding.
\fIpadding\fR is a list of up to four integers specifying
the left, top, right and bottom padding quantities respectively.
If fewer than four elements are specified,
\fIbottom\fR defaults to \fItop\fR,
\fIright\fR defaults to \fIleft\fR, and
\fItop\fR defaults to \fIleft\fR.
In other words, a list of three numbers specify the left, vertical, and right padding;
a list of two numbers specify the horizontal and the vertical padding;
a single number specifies the same padding all the way around the widget.
This option may not be mixed with any other options.
.TP
\fB\-margins \fIpadding\fR
@@ -61,7 +68,7 @@ corresponding Visual Styles API state value.
This permits the element appearance to respond to changes in the
widget state such as becoming active or being pressed. The list should
be as described for the \fBttk::style map\fR command but note that the
last pair in the list should be the default state and is typically and
last pair in the list should be the default state and is typically an
empty list and 1. Unfortunately all the Visual Styles parts have
different state values and these must be looked up either in the
Microsoft documentation or more likely in the header files. The

View File

@@ -71,24 +71,6 @@ See the description of \fB\-xscrollcommand\fR above for details.
.SH "LABEL OPTIONS"
The following options are supported by labels, buttons,
and other button-like widgets:
.OP \-text text Text
Specifies a text string to be displayed inside the widget
(unless overridden by \fB\-textvariable\fR).
.OP \-textvariable textVariable Variable
Specifies the name of a global variable whose value will be used
in place of the \fB\-text\fR resource.
.OP \-underline underline Underline
If set, specifies the integer index (0-based) of a character to underline
in the text string.
The underlined character is used for mnemonic activation.
.OP \-image image Image
Specifies an image to display.
This is a list of 1 or more elements.
The first element is the default image name.
The rest of the list is a sequence of \fIstatespec / value\fR pairs
as per \fBstyle map\fR, specifying different images to use when
the widget is in a particular state or combination of states.
All images in the list should have the same size.
.OP \-compound compound Compound
Specifies how to display the image relative to the text,
in the case both \fB\-text\fR and \fB\-image\fR are present.
@@ -108,12 +90,44 @@ Display image above, below, left of, or right of the text, respectively.
.IP none
The default; display the image if present, otherwise the text.
.RE
.OP \-image image Image
Specifies an image to display.
This is a list of 1 or more elements.
The first element is the default image name.
The rest of the list is a sequence of \fIstatespec / value\fR pairs
as per \fBstyle map\fR, specifying different images to use when
the widget is in a particular state or combination of states.
All images in the list should have the same size.
.OP \-padding padding Padding
Specifies the internal padding for the widget.
The padding is a list of up to four length specifications
\fIleft top right bottom\fR.
If fewer than four elements are specified,
\fIbottom\fR defaults to \fItop\fR,
\fIright\fR defaults to \fIleft\fR, and
\fItop\fR defaults to \fIleft\fR.
In other words, a list of three numbers specify the left, vertical, and right padding;
a list of two numbers specify the horizontal and the vertical padding;
a single number specifies the same padding all the way around the widget.
.OP \-text text Text
Specifies a text string to be displayed inside the widget
(unless overridden by \fB\-textvariable\fR).
.OP \-textvariable textVariable Variable
Specifies the name of a global variable whose value will be used
in place of the \fB\-text\fR resource.
.OP \-underline underline Underline
If set, specifies the integer index (0-based) of a character to underline
in the text string.
The underlined character is used for mnemonic activation.
.OP \-width width Width
If greater than zero, specifies how much space, in character widths,
to allocate for the text label.
If less than zero, specifies a minimum width.
If zero or unspecified, the natural width of the text label is used.
.SH "COMPATIBILITY OPTIONS"
This option is only available for themed widgets that have
.QW corresponding
traditional Tk widgets.
.OP \-state state State
May be set to \fBnormal\fR or \fBdisabled\fR
to control the \fBdisabled\fR state bit.
@@ -178,6 +192,84 @@ will restore \fIpathName\fR to the original state.
If \fIstateSpec\fR is not specified,
returns a list of the currently-enabled state flags.
.RE
.TP
\fIpathName \fBxview \fIargs\fR
This command is used to query and change the horizontal position of the
content in the widget's window. It can take any of the following
forms:
.RS
.TP
\fIpathName \fBxview\fR
Returns a list containing two elements.
Each element is a real fraction between 0 and 1; together they describe
the horizontal span that is visible in the window.
For example, if the first element is .2 and the second element is .6,
20% of the widget's content is off-screen to the left, the middle 40% is visible
in the window, and 40% of the content is off-screen to the right.
These are the same values passed to scrollbars via the \fB\-xscrollcommand\fR
option.
.TP
\fIpathName \fBxview\fR \fIindex\fR
Adjusts the view in the window so that the content given by \fIindex\fR
is displayed at the left edge of the window.
.TP
\fIpathName \fBxview moveto\fI fraction\fR
Adjusts the view in the window so that the character \fIfraction\fR of the
way through the content appears at the left edge of the window.
\fIFraction\fR must be a fraction between 0 and 1.
.TP
\fIpathName \fBxview scroll \fInumber what\fR
This command shifts the view in the window left or right according to
\fInumber\fR and \fIwhat\fR.
\fINumber\fR must be an integer.
\fIWhat\fR must be either \fBunits\fR or \fBpages\fR.
'\" or an abbreviation of one of these, but we don't document that.
If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by
\fInumber\fR average-width characters on the display; if it is
\fBpages\fR then the view adjusts by \fInumber\fR screenfuls.
If \fInumber\fR is negative then characters farther to the left
become visible; if it is positive then characters farther to the right
become visible.
.RE
.TP
\fIpathName \fByview \fIargs\fR
This command is used to query and change the vertical position of the
content in the widget's window. It can take any of the following
forms:
.RS
.TP
\fIpathName \fByview\fR
Returns a list containing two elements.
Each element is a real fraction between 0 and 1; together they describe
the vertical span that is visible in the window.
For example, if the first element is .2 and the second element is .6,
20% of the widget's content is off-screen to the top, the middle 40% is visible
in the window, and 40% of the content is off-screen to the bottom.
These are the same values passed to scrollbars via the \fB\-yscrollcommand\fR
option.
.TP
\fIpathName \fByview\fR \fIindex\fR
Adjusts the view in the window so that the content given by \fIindex\fR
is displayed at the top edge of the window.
.TP
\fIpathName \fByview moveto\fI fraction\fR
Adjusts the view in the window so that the item \fIfraction\fR of the
way through the content appears at the top edge of the window.
\fIFraction\fR must be a fraction between 0 and 1.
.TP
\fIpathName \fByview scroll \fInumber what\fR
This command shifts the view in the window up or down according to
\fInumber\fR and \fIwhat\fR.
\fINumber\fR must be an integer.
\fIWhat\fR must be either \fBunits\fR or \fBpages\fR.
'\" or an abbreviation of one of these, but we don't document that.
If \fIwhat\fR is \fBunits\fR, the view adjusts up or down by
\fInumber\fR average-width characters on the display; if it is
\fBpages\fR then the view adjusts by \fInumber\fR screenfuls.
If \fInumber\fR is negative then items farther to the top
become visible; if it is positive then items farther to the bottom
become visible.
.RE
.SH "WIDGET STATES"
The widget state is a bitmap of independent state flags.
Widget state flags include:

View File

@@ -73,6 +73,9 @@ to the screen containing \fIwindow\fR; otherwise they refer to the
screen of the application's main window.
If no window in this application contains the point then an empty
string is returned.
An empty string is also returned if the point lies in the title bar
or border of its highest containing toplevel in this application.
(Note that with some window managers the borders may be invisible.)
In selecting the containing window, children are given higher priority
than parents and among siblings the highest one in the stacking order is
chosen.

View File

@@ -488,7 +488,13 @@ most modern window managers support. A \fBwm iconbitmap\fR may exist
simultaneously. It is recommended to use not more than 2 icons, placing
the larger icon first.
.PP
On Macintosh, this currently does nothing.
On Macintosh, the first image called is loaded into an OSX-native icon
format, and becomes the application icon in dialogs, the Dock, and
other contexts. At the
script level the command will accept only the first image passed in the
parameters as support for multiple sizes/resolutions on macOS is outside Tk's
scope. Developers should use the largest icon they can support
(preferably 512 pixels) to ensure smooth rendering on the Mac.
.RE
.TP
\fBwm iconposition \fIwindow\fR ?\fIx y\fR?
@@ -704,20 +710,21 @@ specified then the command returns the current title for the
.TP
\fBwm transient \fIwindow\fR ?\fImaster\fR?
.
If \fImaster\fR is specified, then the window manager is informed
that \fIwindow\fR is a transient window (e.g. pull-down menu) working
on behalf of \fImaster\fR (where \fImaster\fR is the
path name for a top-level window). If \fImaster\fR
is specified as an empty string then \fIwindow\fR is marked as not
being a transient window any more. Otherwise the command
returns the path name of \fIwindow\fR's current master, or an
empty string if \fIwindow\fR is not currently a transient window.
A transient window will mirror state changes in the master and
inherit the state of the master when initially mapped. It is an
error to attempt to make a window a transient of itself.
The window manager may also decorate a transient window differently, removing
some features normally present (e.g., minimize and maximize buttons) though
this is entirely at the discretion of the window manager.
If \fImaster\fR is specified, then the window manager is informed that
\fIwindow\fR is a transient window (e.g. pull-down menu) working on
behalf of \fImaster\fR (where \fImaster\fR is the path name for a
top-level window). If \fImaster\fR is specified as an empty string
then \fIwindow\fR is marked as not being a transient window any more.
Otherwise the command returns the path name of \fIwindow\fR's current
master, or an empty string if \fIwindow\fR is not currently a
transient window. A transient window will mirror state changes in the
master and inherit the state of the master when initially mapped. The
directed graph with an edge from each transient to its master must be
acyclic. In particular, it is an error to attempt to make a window a
transient of itself. The window manager may also decorate a transient
window differently, removing some features normally present (e.g.,
minimize and maximize buttons) though this is entirely at the
discretion of the window manager.
.TP
\fBwm withdraw \fIwindow\fR
.

File diff suppressed because it is too large Load Diff

View File

@@ -75,10 +75,10 @@ extern "C" {
#define TK_MAJOR_VERSION 8
#define TK_MINOR_VERSION 6
#define TK_RELEASE_LEVEL TCL_FINAL_RELEASE
#define TK_RELEASE_SERIAL 6
#define TK_RELEASE_SERIAL 10
#define TK_VERSION "8.6"
#define TK_PATCH_LEVEL "8.6.6"
#define TK_PATCH_LEVEL "8.6.10"
/*
* A special definition used to allow this header file to be included from
@@ -92,13 +92,14 @@ extern "C" {
#ifndef RC_INVOKED
#ifndef _XLIB_H
#if !defined(_XLIB_H) && !defined(_X11_XLIB_H_)
# include <X11/Xlib.h>
# ifdef MAC_OSX_TK
# include <X11/X.h>
# endif
#endif
#ifdef __STDC__
#if defined(STDC_HEADERS) || defined(__STDC__) || defined(__C99__FUNC__) \
|| defined(__cplusplus) || defined(_MSC_VER) || defined(__ICC)
# include <stddef.h>
#endif
@@ -266,10 +267,10 @@ typedef struct Tk_ObjCustomOption {
* Computes number of bytes from beginning of structure to a given field.
*/
#ifdef offsetof
#define Tk_Offset(type, field) ((int) offsetof(type, field))
#else
#define Tk_Offset(type, field) ((int) ((char *) &((type *) 0)->field))
/* Workaround for platforms missing offsetof(), e.g. VC++ 6.0 */
#ifndef offsetof
# define offsetof(type, field) ((size_t) ((char *) &((type *) 0)->field))
#endif
/*
@@ -676,7 +677,7 @@ typedef struct {
* request. */
Display *display; /* Display the event was read from. */
Window event; /* Window on which event was requested. */
Window root; /* Root window that the event occured on. */
Window root; /* Root window that the event occurred on. */
Window subwindow; /* Child window. */
Time time; /* Milliseconds. */
int x, y; /* Pointer x, y coordinates in event
@@ -813,7 +814,11 @@ typedef struct Tk_FakeWin {
int internalBorderBottom;
int minReqWidth;
int minReqHeight;
char *dummy20; /* geometryMaster */
#ifdef TK_USE_INPUT_METHODS
int dummy20;
#endif /* TK_USE_INPUT_METHODS */
char *dummy21; /* geomMgrName */
Tk_Window dummy22; /* maintainerPtr */
} Tk_FakeWin;
/*
@@ -1171,7 +1176,7 @@ typedef struct Tk_TSOffset {
} Tk_TSOffset;
/*
* Bit fields in Tk_Offset->flags:
* Bit fields in Tk_TSOffset->flags:
*/
#define TK_OFFSET_INDEX 1

View File

@@ -236,9 +236,9 @@ Tk_Get3DBorder(
borderPtr->darkColorPtr = NULL;
borderPtr->lightColorPtr = NULL;
borderPtr->shadow = None;
borderPtr->bgGC = None;
borderPtr->darkGC = None;
borderPtr->lightGC = None;
borderPtr->bgGC = NULL;
borderPtr->darkGC = NULL;
borderPtr->lightGC = NULL;
borderPtr->hashPtr = hashPtr;
borderPtr->nextPtr = existingBorderPtr;
Tcl_SetHashValue(hashPtr, borderPtr);
@@ -374,7 +374,7 @@ Tk_3DBorderGC(
{
TkBorder * borderPtr = (TkBorder *) border;
if ((borderPtr->lightGC == None) && (which != TK_3D_FLAT_GC)) {
if ((borderPtr->lightGC == NULL) && (which != TK_3D_FLAT_GC)) {
TkpGetShadows(borderPtr, tkwin);
}
if (which == TK_3D_FLAT_GC) {
@@ -391,7 +391,7 @@ Tk_3DBorderGC(
* compilers happy.
*/
return (GC) None;
return NULL;
}
/*
@@ -439,13 +439,13 @@ Tk_Free3DBorder(
if (borderPtr->shadow != None) {
Tk_FreeBitmap(display, borderPtr->shadow);
}
if (borderPtr->bgGC != None) {
if (borderPtr->bgGC != NULL) {
Tk_FreeGC(display, borderPtr->bgGC);
}
if (borderPtr->darkGC != None) {
if (borderPtr->darkGC != NULL) {
Tk_FreeGC(display, borderPtr->darkGC);
}
if (borderPtr->lightGC != None) {
if (borderPtr->lightGC != NULL) {
Tk_FreeGC(display, borderPtr->lightGC);
}
if (prevPtr == borderPtr) {
@@ -765,7 +765,7 @@ Tk_Draw3DPolygon(
int i, lightOnLeft, dx, dy, parallel, pointsSeen;
Display *display = Tk_Display(tkwin);
if (borderPtr->lightGC == None) {
if (borderPtr->lightGC == NULL) {
TkpGetShadows(borderPtr, tkwin);
}
@@ -1315,7 +1315,7 @@ Tk_Get3DBorderFromObj(
*
* Side effects:
* If no error occurs, a blank internal format for a border value is
* intialized. The final form cannot be done without a Tk_Window.
* initialized. The final form cannot be done without a Tk_Window.
*
*----------------------------------------------------------------------
*/

View File

@@ -54,10 +54,10 @@ typedef struct TkBorder {
GC bgGC; /* Used (if necessary) to draw areas in the
* background color. */
GC darkGC; /* Used to draw darker parts of the border.
* None means the shadow colors haven't been
* NULL means the shadow colors haven't been
* allocated yet.*/
GC lightGC; /* Used to draw lighter parts of the border.
* None means the shadow colors haven't been
* NULL means the shadow colors haven't been
* allocated yet. */
Tcl_HashEntry *hashPtr; /* Entry in borderTable (needed in order to
* delete structure). */

610
generic/tkArray.h Normal file
View File

@@ -0,0 +1,610 @@
/*
* tkArray.h --
*
* An array is a sequence of items, stored in a contiguous memory region.
* Random access to any item is very fast. New items can be either appended
* or prepended. An array may be traversed in the forward or backward direction.
*
* Copyright (c) 2018-2019 by Gregor Cramer.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
/*
* Note that this file will not be included in header files, it is the purpose
* of this file to be included in source files only. Thus we are not using the
* prefix "Tk_" here for functions, because all the functions have private scope.
*/
/*
* -------------------------------------------------------------------------------
* Use the array in the following way:
* -------------------------------------------------------------------------------
* typedef struct { int key, value; } Pair;
* TK_PTR_ARRAY_DEFINE(MyArray, Pair);
* MyArray *arr = NULL;
* if (MyArray_IsEmpty(arr)) {
* MyArray_Append(&arr, MakePair(1, 2));
* MyArray_Append(&arr, MakePair(2, 3));
* for (i = 0; i < MyArray_Size(arr); ++i) {
* Pair *p = MyArray_Get(arr, i);
* printf("%d -> %d\n", p->key, p->value);
* ckfree(p);
* }
* MyArray_Free(&arr);
* assert(arr == NULL);
* }
* -------------------------------------------------------------------------------
* Or with aggregated elements:
* -------------------------------------------------------------------------------
* typedef struct { int key, value; } Pair;
* TK_ARRAY_DEFINE(MyArray, Pair);
* Pair p1 = { 1, 2 };
* Pair p2 = { 2, 3 };
* MyArray *arr = NULL;
* if (MyArray_IsEmpty(arr)) {
* MyArray_Append(&arr, p1);
* MyArray_Append(&arr, p2);
* for (i = 0; i < MyArray_Size(arr); ++i) {
* const Pair *p = MyArray_Get(arr, i);
* printf("%d -> %d\n", p->key, p->value);
* }
* MyArray_Free(&arr);
* assert(arr == NULL);
* }
* -------------------------------------------------------------------------------
*/
/*************************************************************************/
/*
* Two array types will be provided:
* Use TK_ARRAY_DEFINE if your array is aggregating the elements. Use
* TK_PTR_ARRAY_DEFINE if your array contains pointers to elements. But
* in latter case the array is not responsible for the lifetime of the
* elements.
*/
/*************************************************************************/
/*
* Array_ElemSize: Returns the memory size for one array element.
*/
/*************************************************************************/
/*
* Array_BufferSize: Returns the memory size for given number of elements.
*/
/*************************************************************************/
/*
* Array_IsEmpty: Array is empty?
*/
/*************************************************************************/
/*
* Array_Size: Number of elements in array.
*/
/*************************************************************************/
/*
* Array_Capacity: Capacity of given array. This is the maximal number of
* elements fitting into current array memory without resizing the buffer.
*/
/*************************************************************************/
/*
* Array_SetSize: Set array size, new size must not exceed the capacity of
* the array. This function has to be used with care when increasing the
* array size.
*/
/*************************************************************************/
/*
* Array_First: Returns position of first element in array. Given array
* may be NULL.
*/
/*************************************************************************/
/*
* Array_Last: Returns position after last element in array. Given array
* may be empty.
*/
/*************************************************************************/
/*
* Array_Front: Returns first element in array. Given array must not be
* empty.
*/
/*************************************************************************/
/*
* Array_Back: Returns last element in array. Given array must not be
* empty.
*/
/*************************************************************************/
/*
* Array_Resize: Resize buffer of array for given number of elements. The
* array may grow or shrink. Note that this function is not initializing
* the increased buffer.
*/
/*************************************************************************/
/*
* Array_ResizeAndClear: Resize buffer of array for given number of
* elements. The array may grow or shrink. The increased memory will be
* filled with zeroes.
*/
/*************************************************************************/
/*
* Array_Clear: Fill specified range with zeroes.
*/
/*************************************************************************/
/*
* Array_Free: Resize array to size zero. This function will release the
* array buffer.
*/
/*************************************************************************/
/*
* Array_Append: Insert given element after end of array.
*/
/*************************************************************************/
/*
* Array_PopBack: Shrink array by one element. Given array must not be
* empty.
*/
/*************************************************************************/
/*
* Array_Get: Random access to array element at given position. The given
* index must not exceed current array size.
*/
/*************************************************************************/
/*
* Array_Set: Replace array element at given position with new value. The
* given index must not exceed current array size.
*/
/*************************************************************************/
/*
* Array_Find: Return index position of element which matches given
* argument. If not found then -1 will be returned.
*/
/*************************************************************************/
#ifndef TK_ARRAY_DEFINED
#define TK_ARRAY_DEFINED
#include "tkInt.h"
#if defined(__GNUC__) || defined(__clang__)
# define __TK_ARRAY_UNUSED __attribute__((unused))
#else
# define __TK_ARRAY_UNUSED
#endif
#define TK_ARRAY_DEFINE(AT, ElemType) /* AT = type of array */ \
/* ------------------------------------------------------------------------- */ \
typedef struct AT { \
size_t size; \
size_t capacity; \
ElemType buf[1]; \
} AT; \
\
__TK_ARRAY_UNUSED \
static void \
AT##_Init(AT *arr) \
{ \
assert(arr); \
arr->size = 0; \
arr->capacity = 0; \
} \
\
__TK_ARRAY_UNUSED \
static size_t \
AT##_ElemSize() \
{ \
return sizeof(ElemType); \
} \
\
__TK_ARRAY_UNUSED \
static size_t \
AT##_BufferSize(size_t numElems) \
{ \
return numElems*sizeof(ElemType); \
} \
\
__TK_ARRAY_UNUSED \
static int \
AT##_IsEmpty(const AT *arr) \
{ \
assert(!arr || arr->size != 0xdeadbeef); \
return !arr || arr->size == 0u; \
} \
\
__TK_ARRAY_UNUSED \
static size_t \
AT##_Size(const AT *arr) \
{ \
assert(!arr || arr->size != 0xdeadbeef); \
return arr ? arr->size : 0u; \
} \
\
__TK_ARRAY_UNUSED \
static size_t \
AT##_Capacity(const AT *arr) \
{ \
assert(!arr || arr->size != 0xdeadbeef); \
return arr ? arr->capacity : 0u; \
} \
\
__TK_ARRAY_UNUSED \
static ElemType * \
AT##_First(AT *arr) \
{ \
assert(!arr || arr->size != 0xdeadbeef); \
return arr ? arr->buf : NULL; \
} \
\
__TK_ARRAY_UNUSED \
static ElemType * \
AT##_Last(AT *arr) \
{ \
assert(!arr || arr->size != 0xdeadbeef); \
return arr ? arr->buf + arr->size : NULL; \
} \
\
__TK_ARRAY_UNUSED \
static ElemType * \
AT##_Front(AT *arr) \
{ \
assert(arr); \
assert(arr->size != 0xdeadbeef); \
assert(!AT##_IsEmpty(arr)); \
return &arr->buf[0]; \
} \
\
__TK_ARRAY_UNUSED \
static ElemType * \
AT##_Back(AT *arr) \
{ \
assert(arr); \
assert(arr->size != 0xdeadbeef); \
assert(!AT##_IsEmpty(arr)); \
return &arr->buf[arr->size - 1]; \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_Resize(AT **arrp, size_t newSize) \
{ \
assert(arrp); \
assert(!*arrp || (*arrp)->size != 0xdeadbeef); \
if (newSize == 0) { \
assert(!*arrp || ((*arrp)->size = 0xdeadbeef)); \
ckfree(*arrp); \
*arrp = NULL; \
} else { \
int init = *arrp == NULL; \
size_t memSize = AT##_BufferSize(newSize - 1) + sizeof(AT); \
*arrp = ckrealloc(*arrp, memSize); \
if (init) { \
(*arrp)->size = 0; \
} else if (newSize < (*arrp)->size) { \
(*arrp)->size = newSize; \
} \
(*arrp)->capacity = newSize; \
} \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_Clear(AT *arr, size_t from, size_t to) \
{ \
assert(arr); \
assert(arr->size != 0xdeadbeef); \
assert(to <= AT##_Capacity(arr)); \
assert(from <= to); \
memset(arr->buf + from, 0, AT##_BufferSize(to - from)); \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_ResizeAndClear(AT **arrp, size_t newSize) \
{ \
size_t oldCapacity; \
assert(arrp); \
oldCapacity = *arrp ? (*arrp)->capacity : 0; \
AT##_Resize(arrp, newSize); \
if (newSize > oldCapacity) { \
AT##_Clear(*arrp, oldCapacity, newSize); \
} \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_SetSize(AT *arr, size_t newSize) \
{ \
assert(newSize <= AT##_Capacity(arr)); \
assert(!arr || arr->size != 0xdeadbeef); \
if (arr) { \
arr->size = newSize; \
} \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_Append(AT **arrp, ElemType *elem) \
{ \
assert(arrp); \
if (!*arrp) { \
AT##_Resize(arrp, 1); \
} else if ((*arrp)->size == (*arrp)->capacity) { \
AT##_Resize(arrp, (*arrp)->capacity + ((*arrp)->capacity + 1)/2); \
} \
(*arrp)->buf[(*arrp)->size++] = *elem; \
} \
\
__TK_ARRAY_UNUSED \
static size_t \
AT##_PopBack(AT *arr) \
{ \
assert(!AT##_IsEmpty(arr)); \
return arr->size -= 1; \
} \
\
__TK_ARRAY_UNUSED \
static ElemType * \
AT##_Get(const AT *arr, size_t at) \
{ \
assert(arr); \
assert(at < AT##_Size(arr)); \
return (ElemType *) &arr->buf[at]; \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_Set(AT *arr, size_t at, ElemType *elem) \
{ \
assert(arr); \
assert(at < AT##_Size(arr)); \
arr->buf[at] = *elem; \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_Free(AT **arrp) \
{ \
AT##_Resize(arrp, 0); \
} \
\
__TK_ARRAY_UNUSED \
static int \
AT##_Find(const AT *arr, const ElemType *elem) \
{ \
assert(!arr || arr->size != 0xdeadbeef); \
if (arr) { \
const ElemType *buf = arr->buf; \
size_t i; \
for (i = 0; i < arr->size; ++i) { \
if (memcmp(&buf[i], elem, sizeof(ElemType)) == 0) { \
return (int) i; \
} \
} \
} \
return -1; \
} \
\
__TK_ARRAY_UNUSED \
static int \
AT##_Contains(const AT *arr, const ElemType *elem) \
{ \
return AT##_Find(arr, elem) != -1; \
} \
/* ------------------------------------------------------------------------- */
#define TK_PTR_ARRAY_DEFINE(AT, ElemType) /* AT = type of array */ \
/* ------------------------------------------------------------------------- */ \
typedef struct AT { \
size_t size; \
size_t capacity; \
ElemType *buf[1]; \
} AT; \
\
__TK_ARRAY_UNUSED \
static size_t \
AT##_ElemSize() \
{ \
return sizeof(ElemType); \
} \
\
__TK_ARRAY_UNUSED \
static size_t \
AT##_BufferSize(size_t numElems) \
{ \
return numElems*sizeof(ElemType *); \
} \
\
__TK_ARRAY_UNUSED \
static int \
AT##_IsEmpty(const AT *arr) \
{ \
assert(!arr || arr->size != 0xdeadbeef); \
return !arr || arr->size == 0; \
} \
\
__TK_ARRAY_UNUSED \
static ElemType ** \
AT##_First(AT *arr) \
{ \
assert(!arr || arr->size != 0xdeadbeef); \
return arr ? arr->buf : NULL; \
} \
\
__TK_ARRAY_UNUSED \
static ElemType ** \
AT##_Last(AT *arr) \
{ \
assert(!arr || arr->size != 0xdeadbeef); \
return arr ? arr->buf + arr->size : NULL; \
} \
\
__TK_ARRAY_UNUSED \
static ElemType * \
AT##_Front(AT *arr) \
{ \
assert(arr); \
assert(arr->size != 0xdeadbeef); \
assert(!AT##_IsEmpty(arr)); \
return arr->buf[0]; \
} \
\
__TK_ARRAY_UNUSED \
static ElemType * \
AT##_Back(AT *arr) \
{ \
assert(arr); \
assert(arr->size != 0xdeadbeef); \
assert(!AT##_IsEmpty(arr)); \
return arr->buf[arr->size - 1]; \
} \
\
__TK_ARRAY_UNUSED \
static size_t \
AT##_Size(const AT *arr) \
{ \
assert(!arr || arr->size != 0xdeadbeef); \
return arr ? arr->size : 0; \
} \
\
__TK_ARRAY_UNUSED \
static size_t \
AT##_Capacity(const AT *arr) \
{ \
assert(!arr || arr->size != 0xdeadbeef); \
return arr ? arr->capacity : 0; \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_Resize(AT **arrp, size_t newCapacity) \
{ \
assert(arrp); \
assert(!*arrp || (*arrp)->size != 0xdeadbeef); \
if (newCapacity == 0) { \
assert(!*arrp || ((*arrp)->size = 0xdeadbeef)); \
ckfree(*arrp); \
*arrp = NULL; \
} else { \
int init = *arrp == NULL; \
size_t memSize = AT##_BufferSize(newCapacity - 1) + sizeof(AT); \
*arrp = ckrealloc(*arrp, memSize); \
if (init) { \
(*arrp)->size = 0; \
} else if (newCapacity < (*arrp)->size) { \
(*arrp)->size = newCapacity; \
} \
(*arrp)->capacity = newCapacity; \
} \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_Clear(AT *arr, size_t from, size_t to) \
{ \
assert(arr); \
assert(arr->size != 0xdeadbeef); \
assert(to <= AT##_Capacity(arr)); \
assert(from <= to); \
memset(arr->buf + from, 0, AT##_BufferSize(to - from)); \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_ResizeAndClear(AT **arrp, size_t newCapacity) \
{ \
size_t oldCapacity; \
assert(arrp); \
oldCapacity = *arrp ? (*arrp)->capacity : 0; \
AT##_Resize(arrp, newCapacity); \
if (newCapacity > oldCapacity) { \
AT##_Clear(*arrp, oldCapacity, newCapacity); \
} \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_SetSize(AT *arr, size_t newSize) \
{ \
assert(arr); \
assert(newSize <= AT##_Capacity(arr)); \
arr->size = newSize; \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_Append(AT **arrp, ElemType *elem) \
{ \
assert(arrp); \
if (!*arrp) { \
AT##_Resize(arrp, 1); \
} else if ((*arrp)->size == (*arrp)->capacity) { \
AT##_Resize(arrp, (*arrp)->capacity + ((*arrp)->capacity + 1)/2); \
} \
(*arrp)->buf[(*arrp)->size++] = elem; \
} \
\
__TK_ARRAY_UNUSED \
static size_t \
AT##_PopBack(AT *arr) \
{ \
assert(!AT##_IsEmpty(arr)); \
return arr->size -= 1; \
} \
\
__TK_ARRAY_UNUSED \
static ElemType * \
AT##_Get(const AT *arr, size_t at) \
{ \
assert(arr); \
assert(at < AT##_Size(arr)); \
return arr->buf[at]; \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_Set(AT *arr, size_t at, ElemType *elem) \
{ \
assert(arr); \
assert(at < AT##_Size(arr)); \
arr->buf[at] = elem; \
} \
\
__TK_ARRAY_UNUSED \
static void \
AT##_Free(AT **arrp) \
{ \
AT##_Resize(arrp, 0); \
} \
\
__TK_ARRAY_UNUSED \
static int \
AT##_Find(const AT *arr, const ElemType *elem) \
{ \
assert(!arr || arr->size != 0xdeadbeef); \
if (arr) { \
ElemType *const *buf = arr->buf; \
size_t i; \
for (i = 0; i < arr->size; ++i) { \
if (buf[i] == elem) { \
return (int) i; \
} \
} \
} \
return -1; \
} \
\
__TK_ARRAY_UNUSED \
static int \
AT##_Contains(const AT *arr, const ElemType *elem) \
{ \
return AT##_Find(arr, elem) != -1; \
} \
/* ------------------------------------------------------------------------- */
#endif /* TK_ARRAY_DEFINED */
/*
* Local Variables:
* mode: c
* c-basic-offset: 4
* fill-column: 105
* End:
* vi:set ts=8 sw=4:
*/

File diff suppressed because it is too large Load Diff

View File

@@ -88,7 +88,7 @@ typedef struct {
int width, height; /* Dimensions of bitmap. */
} DataKey;
typedef struct ThreadSpecificData {
typedef struct {
int initialized; /* 0 means table below needs initializing. */
Tcl_HashTable predefBitmapTable;
/* Hash table created by Tk_DefineBitmap to

View File

@@ -17,16 +17,14 @@
#include "default.h"
/*
* Things about the busy system that may be configured. Note that currently on
* OSX/Aqua, that's nothing at all.
* Things about the busy system that may be configured. Note that on some
* platforms this may or may not have an effect.
*/
static const Tk_OptionSpec busyOptionSpecs[] = {
#ifndef MAC_OSX_TK
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_BUSY_CURSOR, -1, Tk_Offset(Busy, cursor),
TK_OPTION_NULL_OK, 0, 0},
#endif
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};
@@ -521,7 +519,8 @@ CreateBusy(
Tk_Window tkRef) /* Window hosting the busy window */
{
Busy *busyPtr;
int length, x, y;
size_t length;
int x, y;
const char *fmt;
char *name;
Tk_Window tkBusy, tkChild, tkParent;
@@ -570,7 +569,7 @@ CreateBusy(
busyPtr->height = Tk_Height(tkRef);
busyPtr->x = Tk_X(tkRef);
busyPtr->y = Tk_Y(tkRef);
busyPtr->cursor = None;
busyPtr->cursor = NULL;
Tk_SetClass(tkBusy, "Busy");
busyPtr->optionTable = Tk_CreateOptionTable(interp, busyOptionSpecs);
if (Tk_InitOptions(interp, (char *) busyPtr, busyPtr->optionTable,
@@ -600,7 +599,7 @@ CreateBusy(
*/
Tk_ManageGeometry(tkBusy, &busyMgrInfo, busyPtr);
if (busyPtr->cursor != None) {
if (busyPtr->cursor != NULL) {
Tk_DefineCursor(tkBusy, busyPtr->cursor);
}
@@ -645,7 +644,7 @@ ConfigureBusy(
return TCL_ERROR;
}
if (busyPtr->cursor != oldCursor) {
if (busyPtr->cursor == None) {
if (busyPtr->cursor == NULL) {
Tk_UndefineCursor(busyPtr->tkBusy);
} else {
Tk_DefineCursor(busyPtr->tkBusy, busyPtr->cursor);
@@ -880,7 +879,7 @@ Tk_BusyObjCmd(
hPtr = Tcl_NextHashEntry(&cursor)) {
busyPtr = Tcl_GetHashValue(hPtr);
if (pattern == NULL ||
Tcl_StringMatch(Tk_PathName(busyPtr->tkRef), pattern)) {
Tcl_StringCaseMatch(Tk_PathName(busyPtr->tkRef), pattern, 0)) {
Tcl_ListObjAppendElement(interp, objPtr,
TkNewWindowObj(busyPtr->tkRef));
}

View File

@@ -16,7 +16,7 @@
#include "tkButton.h"
#include "default.h"
typedef struct ThreadSpecificData {
typedef struct {
int defaultsInitialized;
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
@@ -710,12 +710,12 @@ ButtonCreate(
butPtr->normalFg = NULL;
butPtr->activeFg = NULL;
butPtr->disabledFg = NULL;
butPtr->normalTextGC = None;
butPtr->activeTextGC = None;
butPtr->disabledGC = None;
butPtr->stippleGC = None;
butPtr->normalTextGC = NULL;
butPtr->activeTextGC = NULL;
butPtr->disabledGC = NULL;
butPtr->stippleGC = NULL;
butPtr->gray = None;
butPtr->copyGC = None;
butPtr->copyGC = NULL;
butPtr->widthPtr = NULL;
butPtr->width = 0;
butPtr->heightPtr = NULL;
@@ -740,7 +740,7 @@ ButtonCreate(
butPtr->onValuePtr = NULL;
butPtr->offValuePtr = NULL;
butPtr->tristateValuePtr = NULL;
butPtr->cursor = None;
butPtr->cursor = NULL;
butPtr->takeFocusPtr = NULL;
butPtr->commandPtr = NULL;
butPtr->flags = 0;
@@ -878,8 +878,14 @@ ButtonWidgetObjCmd(
*/
Tcl_CancelIdleCall(TkpDisplayButton, butPtr);
XFlush(butPtr->display);
(void)XFlush(butPtr->display);
#ifndef MAC_OSX_TK
/*
* On the mac you can not sleep in a display proc, and the
* flash command doesn't do anything anyway.
*/
Tcl_Sleep(50);
#endif
}
}
break;
@@ -975,22 +981,22 @@ DestroyButton(
if (butPtr->tristateImage != NULL) {
Tk_FreeImage(butPtr->tristateImage);
}
if (butPtr->normalTextGC != None) {
if (butPtr->normalTextGC != NULL) {
Tk_FreeGC(butPtr->display, butPtr->normalTextGC);
}
if (butPtr->activeTextGC != None) {
if (butPtr->activeTextGC != NULL) {
Tk_FreeGC(butPtr->display, butPtr->activeTextGC);
}
if (butPtr->disabledGC != None) {
if (butPtr->disabledGC != NULL) {
Tk_FreeGC(butPtr->display, butPtr->disabledGC);
}
if (butPtr->stippleGC != None) {
if (butPtr->stippleGC != NULL) {
Tk_FreeGC(butPtr->display, butPtr->stippleGC);
}
if (butPtr->gray != None) {
Tk_FreeBitmap(butPtr->display, butPtr->gray);
}
if (butPtr->copyGC != None) {
if (butPtr->copyGC != NULL) {
Tk_FreeGC(butPtr->display, butPtr->copyGC);
}
if (butPtr->textLayout != NULL) {
@@ -1169,7 +1175,7 @@ ConfigureButton(
*/
if ((butPtr->type == TYPE_RADIO_BUTTON) &&
(*Tcl_GetString(butPtr->onValuePtr) == 0)) {
(*Tcl_GetString(butPtr->onValuePtr) == '\0')) {
butPtr->flags |= SELECTED;
}
}
@@ -1361,7 +1367,7 @@ TkButtonWorldChanged(
gcValues.graphics_exposures = False;
mask = GCForeground | GCBackground | GCFont | GCGraphicsExposures;
newGC = Tk_GetGC(butPtr->tkwin, mask, &gcValues);
if (butPtr->normalTextGC != None) {
if (butPtr->normalTextGC != NULL) {
Tk_FreeGC(butPtr->display, butPtr->normalTextGC);
}
butPtr->normalTextGC = newGC;
@@ -1371,7 +1377,7 @@ TkButtonWorldChanged(
gcValues.background = Tk_3DBorderColor(butPtr->activeBorder)->pixel;
mask = GCForeground | GCBackground | GCFont;
newGC = Tk_GetGC(butPtr->tkwin, mask, &gcValues);
if (butPtr->activeTextGC != None) {
if (butPtr->activeTextGC != NULL) {
Tk_FreeGC(butPtr->display, butPtr->activeTextGC);
}
butPtr->activeTextGC = newGC;
@@ -1383,7 +1389,7 @@ TkButtonWorldChanged(
* Create the GC that can be used for stippling
*/
if (butPtr->stippleGC == None) {
if (butPtr->stippleGC == NULL) {
gcValues.foreground = gcValues.background;
mask = GCForeground;
if (butPtr->gray == None) {
@@ -1409,12 +1415,12 @@ TkButtonWorldChanged(
gcValues.foreground = gcValues.background;
}
newGC = Tk_GetGC(butPtr->tkwin, mask, &gcValues);
if (butPtr->disabledGC != None) {
if (butPtr->disabledGC != NULL) {
Tk_FreeGC(butPtr->display, butPtr->disabledGC);
}
butPtr->disabledGC = newGC;
if (butPtr->copyGC == None) {
if (butPtr->copyGC == NULL) {
butPtr->copyGC = Tk_GetGC(butPtr->tkwin, 0, &gcValues);
}
@@ -1617,7 +1623,27 @@ ButtonVarProc(
if (flags & TCL_TRACE_UNSETS) {
butPtr->flags &= ~(SELECTED | TRISTATED);
if ((flags & TCL_TRACE_DESTROYED) && !(flags & TCL_INTERP_DESTROYED)) {
if (!Tcl_InterpDeleted(interp)) {
ClientData probe = NULL;
do {
probe = Tcl_VarTraceInfo(interp,
Tcl_GetString(butPtr->selVarNamePtr),
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
ButtonVarProc, probe);
if (probe == (ClientData)butPtr) {
break;
}
} while (probe);
if (probe) {
/*
* We were able to fetch the unset trace for our
* selVarNamePtr, which means it is not unset and not
* the cause of this unset trace. Instead some outdated
* former variable must be, and we should ignore it.
*/
goto redisplay;
}
Tcl_TraceVar2(interp, Tcl_GetString(butPtr->selVarNamePtr),
NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
ButtonVarProc, clientData);
@@ -1709,7 +1735,34 @@ ButtonTextVarProc(
*/
if (flags & TCL_TRACE_UNSETS) {
if ((flags & TCL_TRACE_DESTROYED) && !(flags & TCL_INTERP_DESTROYED)) {
if (!Tcl_InterpDeleted(interp) && butPtr->textVarNamePtr != NULL) {
/*
* An unset trace on some variable brought us here, but is it
* the variable we have stored in butPtr->textVarNamePtr ?
*/
ClientData probe = NULL;
do {
probe = Tcl_VarTraceInfo(interp,
Tcl_GetString(butPtr->textVarNamePtr),
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
ButtonTextVarProc, probe);
if (probe == (ClientData)butPtr) {
break;
}
} while (probe);
if (probe) {
/*
* We were able to fetch the unset trace for our
* textVarNamePtr, which means it is not unset and not
* the cause of this unset trace. Instead some outdated
* former textvariable must be, and we should ignore it.
*/
return NULL;
}
Tcl_ObjSetVar2(interp, butPtr->textVarNamePtr, NULL,
butPtr->textPtr, TCL_GLOBAL_ONLY);
Tcl_TraceVar2(interp, Tcl_GetString(butPtr->textVarNamePtr),

View File

@@ -235,7 +235,7 @@ typedef struct {
* Miscellaneous information:
*/
Tk_Cursor cursor; /* Value of -cursor option: if not None,
Tk_Cursor cursor; /* Value of -cursor option: if not NULL,
* specifies current cursor for window. */
Tcl_Obj *takeFocusPtr; /* Value of -takefocus option; not used in the
* C code, but used by keyboard traversal

View File

@@ -12,6 +12,7 @@
#include "tkInt.h"
#include "tkCanvas.h"
#include "default.h"
/*
* The structure below defines the record for each arc item.
@@ -144,7 +145,7 @@ static const Tk_ConfigSpec configSpecs[] = {
"0,0", Tk_Offset(ArcItem, tsoffset),
TK_CONFIG_DONT_SET_DEFAULT, &offsetOption},
{TK_CONFIG_COLOR, "-outline", NULL, NULL,
"black", Tk_Offset(ArcItem, outline.color), TK_CONFIG_NULL_OK, NULL},
DEF_CANVITEM_OUTLINE, Tk_Offset(ArcItem, outline.color), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-outlineoffset", NULL, NULL,
"0,0", Tk_Offset(ArcItem, outline.tsoffset),
TK_CONFIG_DONT_SET_DEFAULT, &offsetOption},
@@ -290,7 +291,7 @@ CreateArc(
arcPtr->activeFillStipple = None;
arcPtr->disabledFillStipple = None;
arcPtr->style = PIESLICE_STYLE;
arcPtr->fillGC = None;
arcPtr->fillGC = NULL;
/*
* Process the arguments to fill in the item record.
@@ -478,9 +479,9 @@ ConfigureArc(
mask |= GCCapStyle;
newGC = Tk_GetGC(tkwin, mask, &gcValues);
} else {
newGC = None;
newGC = NULL;
}
if (arcPtr->outline.gc != None) {
if (arcPtr->outline.gc != NULL) {
Tk_FreeGC(Tk_Display(tkwin), arcPtr->outline.gc);
}
arcPtr->outline.gc = newGC;
@@ -512,9 +513,9 @@ ConfigureArc(
}
if (arcPtr->style == ARC_STYLE) {
newGC = None;
newGC = NULL;
} else if (color == NULL) {
newGC = None;
newGC = NULL;
} else {
gcValues.foreground = color->pixel;
if (arcPtr->style == CHORD_STYLE) {
@@ -530,7 +531,7 @@ ConfigureArc(
}
newGC = Tk_GetGC(tkwin, mask, &gcValues);
}
if (arcPtr->fillGC != None) {
if (arcPtr->fillGC != NULL) {
Tk_FreeGC(Tk_Display(tkwin), arcPtr->fillGC);
}
arcPtr->fillGC = newGC;
@@ -603,7 +604,7 @@ DeleteArc(
if (arcPtr->disabledFillStipple != None) {
Tk_FreeBitmap(display, arcPtr->disabledFillStipple);
}
if (arcPtr->fillGC != None) {
if (arcPtr->fillGC != NULL) {
Tk_FreeGC(display, arcPtr->fillGC);
}
}
@@ -734,7 +735,7 @@ ComputeArcBbox(
* drawn) and add one extra pixel just for safety.
*/
if (arcPtr->outline.gc == None) {
if (arcPtr->outline.gc == NULL) {
tmp = 1;
} else {
tmp = (int) ((width + 1.0)/2.0 + 1);
@@ -833,7 +834,7 @@ DisplayArc(
* window servers to crash and should be a no-op anyway.
*/
if ((arcPtr->fillGC != None) && (extent != 0)) {
if ((arcPtr->fillGC != NULL) && (extent != 0)) {
if (stipple != None) {
int w = 0;
int h = 0;
@@ -867,7 +868,7 @@ DisplayArc(
XSetTSOrigin(display, arcPtr->fillGC, 0, 0);
}
}
if (arcPtr->outline.gc != None) {
if (arcPtr->outline.gc != NULL) {
Tk_ChangeOutlineGC(canvas, itemPtr, &(arcPtr->outline));
if (extent != 0) {
@@ -905,13 +906,13 @@ DisplayArc(
} else {
if (arcPtr->style == CHORD_STYLE) {
TkFillPolygon(canvas, arcPtr->outlinePtr, CHORD_OUTLINE_PTS,
display, drawable, arcPtr->outline.gc, None);
display, drawable, arcPtr->outline.gc, NULL);
} else if (arcPtr->style == PIESLICE_STYLE) {
TkFillPolygon(canvas, arcPtr->outlinePtr, PIE_OUTLINE1_PTS,
display, drawable, arcPtr->outline.gc, None);
display, drawable, arcPtr->outline.gc, NULL);
TkFillPolygon(canvas, arcPtr->outlinePtr + 2*PIE_OUTLINE1_PTS,
PIE_OUTLINE2_PTS, display, drawable,
arcPtr->outline.gc, None);
arcPtr->outline.gc, NULL);
}
}
@@ -1017,12 +1018,12 @@ ArcToPoint(
return dist;
}
if ((arcPtr->fillGC != None) || (arcPtr->outline.gc == None)) {
if ((arcPtr->fillGC != NULL) || (arcPtr->outline.gc == NULL)) {
filled = 1;
} else {
filled = 0;
}
if (arcPtr->outline.gc == None) {
if (arcPtr->outline.gc == NULL) {
width = 0.0;
}
@@ -1144,12 +1145,12 @@ ArcToArea(
}
}
if ((arcPtr->fillGC != None) || (arcPtr->outline.gc == None)) {
if ((arcPtr->fillGC != NULL) || (arcPtr->outline.gc == NULL)) {
filled = 1;
} else {
filled = 0;
}
if (arcPtr->outline.gc == None) {
if (arcPtr->outline.gc == NULL) {
width = 0.0;
}
@@ -1883,7 +1884,7 @@ ArcToPostscript(
* arc.
*/
if (arcPtr->fillGC != None) {
if (arcPtr->fillGC != NULL) {
Tcl_AppendPrintfToObj(psObj,
"matrix currentmatrix\n"
"%.15g %.15g translate %.15g %.15g scale\n",
@@ -1912,7 +1913,7 @@ ArcToPostscript(
}
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
if (arcPtr->outline.gc != None) {
if (arcPtr->outline.gc != NULL) {
Tcl_AppendToObj(psObj, "grestore gsave\n", -1);
}
} else {
@@ -1924,7 +1925,7 @@ ArcToPostscript(
* If there's an outline for the arc, draw it.
*/
if (arcPtr->outline.gc != None) {
if (arcPtr->outline.gc != NULL) {
Tcl_AppendPrintfToObj(psObj,
"matrix currentmatrix\n"
"%.15g %.15g translate %.15g %.15g scale\n",

View File

@@ -12,6 +12,7 @@
#include "tkInt.h"
#include "tkCanvas.h"
#include "default.h"
/*
* The structure below defines the record for each bitmap item.
@@ -70,7 +71,7 @@ static const Tk_ConfigSpec configSpecs[] = {
NULL, Tk_Offset(BitmapItem, disabledFgColor),
TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_COLOR, "-foreground", NULL, NULL,
"black", Tk_Offset(BitmapItem, fgColor), 0, NULL},
DEF_CANVBMAP_FG, Tk_Offset(BitmapItem, fgColor), 0, NULL},
{TK_CONFIG_CUSTOM, "-state", NULL, NULL,
NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK,
&stateOption},
@@ -189,7 +190,7 @@ TkcCreateBitmap(
bmapPtr->bgColor = NULL;
bmapPtr->activeBgColor = NULL;
bmapPtr->disabledBgColor = NULL;
bmapPtr->gc = None;
bmapPtr->gc = NULL;
/*
* Process the arguments to fill in the item record. Only 1 (list) or 2 (x
@@ -372,7 +373,7 @@ ConfigureBitmap(
}
if (bitmap == None) {
newGC = None;
newGC = NULL;
} else {
gcValues.foreground = fgColor->pixel;
mask = GCForeground;
@@ -385,7 +386,7 @@ ConfigureBitmap(
}
newGC = Tk_GetGC(tkwin, mask, &gcValues);
}
if (bmapPtr->gc != None) {
if (bmapPtr->gc != NULL) {
Tk_FreeGC(Tk_Display(tkwin), bmapPtr->gc);
}
bmapPtr->gc = newGC;

View File

@@ -449,7 +449,7 @@ ComputeImageBbox(
x = (int) (imgPtr->x + ((imgPtr->x >= 0) ? 0.5 : - 0.5));
y = (int) (imgPtr->y + ((imgPtr->y >= 0) ? 0.5 : - 0.5));
if ((state == TK_STATE_HIDDEN) || (image == None)) {
if ((state == TK_STATE_HIDDEN) || (image == NULL)) {
imgPtr->header.x1 = imgPtr->header.x2 = x;
imgPtr->header.y1 = imgPtr->header.y2 = y;
return;

View File

@@ -13,6 +13,7 @@
#include "tkInt.h"
#include "tkCanvas.h"
#include "default.h"
/*
* The structure below defines the record for each line item.
@@ -175,7 +176,7 @@ static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_CAP_STYLE, "-capstyle", NULL, NULL,
"butt", Tk_Offset(LineItem, capStyle), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_COLOR, "-fill", NULL, NULL,
"black", Tk_Offset(LineItem, outline.color), TK_CONFIG_NULL_OK, NULL},
DEF_CANVITEM_OUTLINE, Tk_Offset(LineItem, outline.color), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-dash", NULL, NULL,
NULL, Tk_Offset(LineItem, outline.dash),
TK_CONFIG_NULL_OK, &dashOption},
@@ -296,7 +297,7 @@ CreateLine(
linePtr->coordPtr = NULL;
linePtr->capStyle = CapButt;
linePtr->joinStyle = JoinRound;
linePtr->arrowGC = None;
linePtr->arrowGC = NULL;
linePtr->arrow = ARROWS_NONE;
linePtr->arrowShapeA = (float)8.0;
linePtr->arrowShapeB = (float)10.0;
@@ -521,12 +522,12 @@ ConfigureLine(
#endif
arrowGC = Tk_GetGC(tkwin, mask, &gcValues);
} else {
newGC = arrowGC = None;
newGC = arrowGC = NULL;
}
if (linePtr->outline.gc != None) {
if (linePtr->outline.gc != NULL) {
Tk_FreeGC(Tk_Display(tkwin), linePtr->outline.gc);
}
if (linePtr->arrowGC != None) {
if (linePtr->arrowGC != NULL) {
Tk_FreeGC(Tk_Display(tkwin), linePtr->arrowGC);
}
linePtr->outline.gc = newGC;
@@ -611,7 +612,7 @@ DeleteLine(
if (linePtr->coordPtr != NULL) {
ckfree(linePtr->coordPtr);
}
if (linePtr->arrowGC != None) {
if (linePtr->arrowGC != NULL) {
Tk_FreeGC(display, linePtr->arrowGC);
}
if (linePtr->firstArrowPtr != NULL) {
@@ -840,7 +841,7 @@ DisplayLine(
int numPoints;
Tk_State state = itemPtr->state;
if ((!linePtr->numPoints) || (linePtr->outline.gc == None)) {
if (!linePtr->numPoints || (linePtr->outline.gc == NULL)) {
return;
}

View File

@@ -13,6 +13,7 @@
#include "tkInt.h"
#include "tkCanvas.h"
#include "default.h"
/*
* The structure below defines the record for each polygon item.
@@ -112,8 +113,9 @@ static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_CUSTOM, "-disabledwidth", NULL, NULL,
"0.0", Tk_Offset(PolygonItem, outline.disabledWidth),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
/* Remark: Default for -fill should be NULL, see [2860519]. Will be fixed in Tk 8.7 */
{TK_CONFIG_COLOR, "-fill", NULL, NULL,
"black", Tk_Offset(PolygonItem, fillColor), TK_CONFIG_NULL_OK, NULL},
DEF_CANVITEM_OUTLINE, Tk_Offset(PolygonItem, fillColor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_JOIN_STYLE, "-joinstyle", NULL, NULL,
"round", Tk_Offset(PolygonItem, joinStyle), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_CUSTOM, "-offset", NULL, NULL,
@@ -273,7 +275,7 @@ CreatePolygon(
polyPtr->fillStipple = None;
polyPtr->activeFillStipple = None;
polyPtr->disabledFillStipple = None;
polyPtr->fillGC = None;
polyPtr->fillGC = NULL;
polyPtr->smooth = NULL;
polyPtr->splineSteps = 12;
polyPtr->autoClosed = 0;
@@ -478,9 +480,9 @@ ConfigurePolygon(
mask |= GCCapStyle|GCJoinStyle;
newGC = Tk_GetGC(tkwin, mask, &gcValues);
} else {
newGC = None;
newGC = NULL;
}
if (polyPtr->outline.gc != None) {
if (polyPtr->outline.gc != NULL) {
Tk_FreeGC(Tk_Display(tkwin), polyPtr->outline.gc);
}
polyPtr->outline.gc = newGC;
@@ -504,7 +506,7 @@ ConfigurePolygon(
}
if (color == NULL) {
newGC = None;
newGC = NULL;
} else {
gcValues.foreground = color->pixel;
mask = GCForeground;
@@ -518,13 +520,13 @@ ConfigurePolygon(
* Mac OS X CG drawing needs access to the outline linewidth
* even for fills (as linewidth controls antialiasing).
*/
gcValues.line_width = polyPtr->outline.gc != None ?
gcValues.line_width = polyPtr->outline.gc != NULL ?
polyPtr->outline.gc->line_width : 0;
mask |= GCLineWidth;
#endif
newGC = Tk_GetGC(tkwin, mask, &gcValues);
}
if (polyPtr->fillGC != None) {
if (polyPtr->fillGC != NULL) {
Tk_FreeGC(Tk_Display(tkwin), polyPtr->fillGC);
}
polyPtr->fillGC = newGC;
@@ -590,7 +592,7 @@ DeletePolygon(
if (polyPtr->disabledFillStipple != None) {
Tk_FreeBitmap(display, polyPtr->disabledFillStipple);
}
if (polyPtr->fillGC != None) {
if (polyPtr->fillGC != NULL) {
Tk_FreeGC(display, polyPtr->fillGC);
}
}
@@ -694,7 +696,7 @@ ComputePolygonBbox(
}
}
if (polyPtr->outline.gc != None) {
if (polyPtr->outline.gc != NULL) {
tsoffset = &polyPtr->outline.tsoffset;
if (tsoffset) {
if (tsoffset->flags & TK_OFFSET_INDEX) {
@@ -836,11 +838,11 @@ TkFillPolygon(
* allocated.
*/
if (gc != None && numPoints > 3) {
if (gc != NULL && numPoints > 3) {
XFillPolygon(display, drawable, gc, pointPtr, numPoints, Complex,
CoordModeOrigin);
}
if (outlineGC != None) {
if (outlineGC != NULL) {
XDrawLines(display, drawable, outlineGC, pointPtr, numPoints,
CoordModeOrigin);
}
@@ -881,9 +883,9 @@ DisplayPolygon(
Pixmap stipple = polyPtr->fillStipple;
double linewidth = polyPtr->outline.width;
if (((polyPtr->fillGC == None) && (polyPtr->outline.gc == None)) ||
if (((polyPtr->fillGC == NULL) && (polyPtr->outline.gc == NULL)) ||
(polyPtr->numPoints < 1) ||
(polyPtr->numPoints < 3 && polyPtr->outline.gc == None)) {
(polyPtr->numPoints < 3 && polyPtr->outline.gc == NULL)) {
return;
}
@@ -911,7 +913,7 @@ DisplayPolygon(
* reset the offset when done, since the GC is supposed to be read-only.
*/
if ((stipple != None) && (polyPtr->fillGC != None)) {
if ((stipple != None) && (polyPtr->fillGC != NULL)) {
Tk_TSOffset *tsoffset = &polyPtr->tsoffset;
int w = 0, h = 0;
int flags = tsoffset->flags;
@@ -973,11 +975,11 @@ DisplayPolygon(
}
numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr,
polyPtr->numPoints, polyPtr->splineSteps, pointPtr, NULL);
if (polyPtr->fillGC != None) {
if (polyPtr->fillGC != NULL) {
XFillPolygon(display, drawable, polyPtr->fillGC, pointPtr,
numPoints, Complex, CoordModeOrigin);
}
if (polyPtr->outline.gc != None) {
if (polyPtr->outline.gc != NULL) {
XDrawLines(display, drawable, polyPtr->outline.gc, pointPtr,
numPoints, CoordModeOrigin);
}
@@ -986,7 +988,7 @@ DisplayPolygon(
}
}
Tk_ResetOutlineGC(canvas, itemPtr, &polyPtr->outline);
if ((stipple != None) && (polyPtr->fillGC != None)) {
if ((stipple != None) && (polyPtr->fillGC != NULL)) {
XSetTSOrigin(display, polyPtr->fillGC, 0, 0);
}
}
@@ -1299,7 +1301,7 @@ PolygonToPoint(
if (bestDist <= 0.0) {
goto donepoint;
}
if ((polyPtr->outline.gc != None) && (polyPtr->joinStyle == JoinRound)) {
if ((polyPtr->outline.gc != NULL) && (polyPtr->joinStyle == JoinRound)) {
dist = bestDist - radius;
if (dist <= 0.0) {
bestDist = 0.0;
@@ -1309,7 +1311,7 @@ PolygonToPoint(
}
}
if ((polyPtr->outline.gc == None) || (width <= 1)) {
if ((polyPtr->outline.gc == NULL) || (width <= 1)) {
goto donepoint;
}
@@ -1515,7 +1517,7 @@ PolygonToArea(
goto donearea;
}
if (polyPtr->outline.gc == None) {
if (polyPtr->outline.gc == NULL) {
goto donearea;
}

View File

@@ -381,7 +381,7 @@ TkCanvPostscriptCmd(
*/
psInfo.chan = Tcl_GetChannel(interp, psInfo.channelName, &mode);
if (psInfo.chan == (Tcl_Channel) NULL) {
if (psInfo.chan == NULL) {
result = TCL_ERROR;
goto cleanup;
}
@@ -825,7 +825,7 @@ Tk_PostscriptFont(
fontname = Tcl_DStringValue(&ds);
Tcl_AppendPrintfToObj(GetPostscriptBuffer(interp),
"/%s findfont %d scalefont%s setfont\n",
fontname, TkFontGetPoints(psInfoPtr->tkwin, points),
fontname, (int)(TkFontGetPoints(psInfoPtr->tkwin, points) + 0.5),
strncasecmp(fontname, "Symbol", 7) ? " ISOEncode" : "");
Tcl_CreateHashEntry(&psInfoPtr->fontTable, Tcl_DStringValue(&ds), &i);
Tcl_DStringFree(&ds);
@@ -1279,7 +1279,7 @@ TkPostscriptImage(
cdata.colors = ckalloc(sizeof(XColor) * ncolors);
cdata.ncolors = ncolors;
if (visual->class == DirectColor || visual->class == TrueColor) {
if (visual->c_class == DirectColor || visual->c_class == TrueColor) {
cdata.separated = 1;
cdata.red_mask = visual->red_mask;
cdata.green_mask = visual->green_mask;
@@ -1311,7 +1311,7 @@ TkPostscriptImage(
}
}
if (visual->class == StaticGray || visual->class == GrayScale) {
if (visual->c_class == StaticGray || visual->c_class == GrayScale) {
cdata.color = 0;
} else {
cdata.color = 1;

View File

@@ -107,7 +107,7 @@ static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL,
NULL, Tk_Offset(TextItem, disabledStipple), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_COLOR, "-fill", NULL, NULL,
"black", Tk_Offset(TextItem, color), TK_CONFIG_NULL_OK, NULL},
DEF_CANVITEM_OUTLINE, Tk_Offset(TextItem, color), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_FONT, "-font", NULL, NULL,
DEF_CANVTEXT_FONT, Tk_Offset(TextItem, tkfont), 0, NULL},
{TK_CONFIG_JUSTIFY, "-justify", NULL, NULL,
@@ -269,9 +269,9 @@ CreateText(
textPtr->textLayout = NULL;
textPtr->actualWidth = 0;
textPtr->drawOrigin[0] = textPtr->drawOrigin[1] = 0.0;
textPtr->gc = None;
textPtr->selTextGC = None;
textPtr->cursorOffGC = None;
textPtr->gc = NULL;
textPtr->selTextGC = NULL;
textPtr->cursorOffGC = NULL;
textPtr->sine = 0.0;
textPtr->cosine = 1.0;
@@ -447,7 +447,7 @@ ConfigureText(
}
}
newGC = newSelGC = None;
newGC = newSelGC = NULL;
if (textPtr->tkfont != NULL) {
gcValues.font = Tk_FontId(textPtr->tkfont);
mask = GCFont;
@@ -472,11 +472,11 @@ ConfigureText(
}
newSelGC = Tk_GetGC(tkwin, mask|GCForeground, &gcValues);
}
if (textPtr->gc != None) {
if (textPtr->gc != NULL) {
Tk_FreeGC(Tk_Display(tkwin), textPtr->gc);
}
textPtr->gc = newGC;
if (textPtr->selTextGC != None) {
if (textPtr->selTextGC != NULL) {
Tk_FreeGC(Tk_Display(tkwin), textPtr->selTextGC);
}
textPtr->selTextGC = newSelGC;
@@ -491,9 +491,9 @@ ConfigureText(
}
newGC = Tk_GetGC(tkwin, GCForeground, &gcValues);
} else {
newGC = None;
newGC = NULL;
}
if (textPtr->cursorOffGC != None) {
if (textPtr->cursorOffGC != NULL) {
Tk_FreeGC(Tk_Display(tkwin), textPtr->cursorOffGC);
}
textPtr->cursorOffGC = newGC;
@@ -592,13 +592,13 @@ DeleteText(
}
Tk_FreeTextLayout(textPtr->textLayout);
if (textPtr->gc != None) {
if (textPtr->gc != NULL) {
Tk_FreeGC(display, textPtr->gc);
}
if (textPtr->selTextGC != None) {
if (textPtr->selTextGC != NULL) {
Tk_FreeGC(display, textPtr->selTextGC);
}
if (textPtr->cursorOffGC != None) {
if (textPtr->cursorOffGC != NULL) {
Tk_FreeGC(display, textPtr->cursorOffGC);
}
}
@@ -820,7 +820,7 @@ DisplayCanvText(
}
}
if (textPtr->gc == None) {
if (textPtr->gc == NULL) {
return;
}
@@ -932,7 +932,7 @@ DisplayCanvText(
Tk_Fill3DPolygon(Tk_CanvasTkwin(canvas), drawable,
textInfoPtr->insertBorder, points, 4,
textInfoPtr->insertBorderWidth, TK_RELIEF_RAISED);
} else if (textPtr->cursorOffGC != None) {
} else if (textPtr->cursorOffGC != NULL) {
/*
* Redraw the background over the area of the cursor, even
* though the cursor is turned off. This guarantees that the

View File

@@ -12,7 +12,6 @@
#include "tkInt.h"
#include "tkCanvas.h"
#include <assert.h>
/*
* Structures defined only in this file.
@@ -961,7 +960,7 @@ void
Tk_CreateOutline(
Tk_Outline *outline) /* Outline structure to be filled in. */
{
outline->gc = None;
outline->gc = NULL;
outline->width = 1.0;
outline->activeWidth = 0.0;
outline->disabledWidth = 0.0;
@@ -1002,7 +1001,7 @@ Tk_DeleteOutline(
Display *display, /* Display containing window. */
Tk_Outline *outline)
{
if (outline->gc != None) {
if (outline->gc != NULL) {
Tk_FreeGC(display, outline->gc);
}
if ((unsigned) ABS(outline->dash.number) > sizeof(char *)) {
@@ -1136,7 +1135,9 @@ Tk_ConfigOutlineGC(
if (mask && (dash->number != 0)) {
gcValues->line_style = LineOnOffDash;
gcValues->dash_offset = outline->offset;
if (dash->number > 0) {
if ((unsigned int)ABS(dash->number) > sizeof(char *)) {
gcValues->dashes = dash->pattern.pt[0];
} else if (dash->number != 0) {
gcValues->dashes = dash->pattern.array[0];
} else {
gcValues->dashes = (char) (4 * width + 0.5);
@@ -1340,7 +1341,9 @@ Tk_ResetOutlineGC(
if ((dash->number > 2) || (dash->number < -1) || (dash->number==2 &&
(dash->pattern.array[0] != dash->pattern.array[1])) ||
((dash->number == -1) && (dash->pattern.array[0] != ','))) {
if (dash->number > 0) {
if ((unsigned int)ABS(dash->number) > sizeof(char *)) {
dashList = dash->pattern.pt[0];
} else if (dash->number != 0) {
dashList = dash->pattern.array[0];
} else {
dashList = (char) (4 * width + 0.5);

View File

@@ -678,7 +678,7 @@ Tk_CanvasObjCmd(
canvasPtr->highlightBgColorPtr = NULL;
canvasPtr->highlightColorPtr = NULL;
canvasPtr->inset = 0;
canvasPtr->pixmapGC = None;
canvasPtr->pixmapGC = NULL;
canvasPtr->width = None;
canvasPtr->height = None;
canvasPtr->confine = 0;
@@ -698,7 +698,7 @@ Tk_CanvasObjCmd(
canvasPtr->textInfo.cursorOn = 0;
canvasPtr->insertOnTime = 0;
canvasPtr->insertOffTime = 0;
canvasPtr->insertBlinkHandler = (Tcl_TimerToken) NULL;
canvasPtr->insertBlinkHandler = NULL;
canvasPtr->xOrigin = canvasPtr->yOrigin = 0;
canvasPtr->drawableXOrigin = canvasPtr->drawableYOrigin = 0;
canvasPtr->bindingTable = NULL;
@@ -724,7 +724,7 @@ Tk_CanvasObjCmd(
canvasPtr->scanYOrigin = 0;
canvasPtr->hotPtr = NULL;
canvasPtr->hotPrevPtr = NULL;
canvasPtr->cursor = None;
canvasPtr->cursor = NULL;
canvasPtr->takeFocus = NULL;
canvasPtr->pixelsPerMM = WidthOfScreen(Tk_Screen(newWin));
canvasPtr->pixelsPerMM /= WidthMMOfScreen(Tk_Screen(newWin));
@@ -1027,7 +1027,7 @@ CanvasWidgetCmd(
result = TCL_ERROR;
goto done;
}
if (mask & (unsigned) ~(ButtonMotionMask|Button1MotionMask
if (mask & ~(unsigned long)(ButtonMotionMask|Button1MotionMask
|Button2MotionMask|Button3MotionMask|Button4MotionMask
|Button5MotionMask|ButtonPressMask|ButtonReleaseMask
|EnterWindowMask|LeaveWindowMask|KeyPressMask
@@ -1186,8 +1186,8 @@ CanvasWidgetCmd(
FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto doneImove) {
int index;
int x1,x2,y1,y2;
int dontRedraw1,dontRedraw2;
int x1, x2, y1, y2;
int dontRedraw1, dontRedraw2;
/*
* The TK_MOVABLE_POINTS flag should only be set for types that
@@ -1217,11 +1217,11 @@ CanvasWidgetCmd(
itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW;
ItemDelChars(canvasPtr, itemPtr, index, index);
dontRedraw1=itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW;
dontRedraw1 = itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW;
itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW;
ItemInsert(canvasPtr, itemPtr, index, tmpObj);
dontRedraw2=itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW;
dontRedraw2 = itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW;
if (!(dontRedraw1 && dontRedraw2)) {
Tk_CanvasEventuallyRedraw((Tk_Canvas) canvasPtr,
@@ -1334,7 +1334,7 @@ CanvasWidgetCmd(
}
case CANV_DCHARS: {
int first, last;
int x1,x2,y1,y2;
int x1, x2, y1, y2;
if ((objc != 4) && (objc != 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "tagOrId first ?last?");
@@ -1362,7 +1362,7 @@ CanvasWidgetCmd(
/*
* Redraw both item's old and new areas: it's possible that a
* delete could result in a new area larger than the old area.
* Except if the insertProc sets the TK_ITEM_DONT_REDRAW flag,
* Except if the dCharsProc sets the TK_ITEM_DONT_REDRAW flag,
* nothing more needs to be done.
*/
@@ -1572,7 +1572,7 @@ CanvasWidgetCmd(
}
case CANV_INSERT: {
int beforeThis;
int x1,x2,y1,y2;
int x1, x2, y1, y2;
if (objc != 5) {
Tcl_WrongNumArgs(interp, 2, objv, "tagOrId beforeThis string");
@@ -1800,7 +1800,8 @@ CanvasWidgetCmd(
}
case CANV_RCHARS: {
int first, last;
int x1,x2,y1,y2;
int x1, x2, y1, y2;
int dontRedraw1, dontRedraw2;
if (objc != 6) {
Tcl_WrongNumArgs(interp, 2, objv, "tagOrId first last string");
@@ -1831,12 +1832,16 @@ CanvasWidgetCmd(
x1 = itemPtr->x1; y1 = itemPtr->y1;
x2 = itemPtr->x2; y2 = itemPtr->y2;
itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW;
itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW;
ItemDelChars(canvasPtr, itemPtr, first, last);
ItemInsert(canvasPtr, itemPtr, first, objv[5]);
dontRedraw1 = itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW;
if (!(itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW)) {
itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW;
ItemInsert(canvasPtr, itemPtr, first, objv[5]);
dontRedraw2 = itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW;
if (!(dontRedraw1 && dontRedraw2)) {
Tk_CanvasEventuallyRedraw((Tk_Canvas) canvasPtr,
x1, y1, x2, y2);
EventuallyRedrawItem(canvasPtr, itemPtr);
@@ -2184,7 +2189,7 @@ DestroyCanvas(
*/
Tcl_DeleteHashTable(&canvasPtr->idTable);
if (canvasPtr->pixmapGC != None) {
if (canvasPtr->pixmapGC != NULL) {
Tk_FreeGC(canvasPtr->display, canvasPtr->pixmapGC);
}
#ifndef USE_OLD_TAG_SEARCH
@@ -2260,7 +2265,7 @@ ConfigureCanvas(
gcValues.foreground = Tk_3DBorderColor(canvasPtr->bgBorder)->pixel;
newGC = Tk_GetGC(canvasPtr->tkwin,
GCFunction|GCGraphicsExposures|GCForeground, &gcValues);
if (canvasPtr->pixmapGC != None) {
if (canvasPtr->pixmapGC != NULL) {
Tk_FreeGC(canvasPtr->display, canvasPtr->pixmapGC);
}
canvasPtr->pixmapGC = newGC;
@@ -2884,7 +2889,7 @@ EventuallyRedrawItem(
Tk_Item *itemPtr) /* Item to be redrawn. May be NULL, in which
* case nothing happens. */
{
if (itemPtr == NULL) {
if (itemPtr == NULL || canvasPtr->tkwin == NULL) {
return;
}
if ((itemPtr->x1 >= itemPtr->x2) || (itemPtr->y1 >= itemPtr->y2) ||
@@ -4742,7 +4747,7 @@ CanvasBindProc(
XEvent *eventPtr) /* Pointer to X event that just happened. */
{
TkCanvas *canvasPtr = clientData;
int mask;
unsigned long mask;
Tcl_Preserve(canvasPtr);
@@ -4755,26 +4760,7 @@ CanvasBindProc(
switch (eventPtr->type) {
case ButtonPress:
case ButtonRelease:
switch (eventPtr->xbutton.button) {
case Button1:
mask = Button1Mask;
break;
case Button2:
mask = Button2Mask;
break;
case Button3:
mask = Button3Mask;
break;
case Button4:
mask = Button4Mask;
break;
case Button5:
mask = Button5Mask;
break;
default:
mask = 0;
break;
}
mask = TkGetButtonMask(eventPtr->xbutton.button);
/*
* For button press events, repick the current item using the button
@@ -4857,7 +4843,7 @@ PickCurrentItem(
* ButtonRelease, or MotionNotify. */
{
double coords[2];
int buttonDown;
unsigned long buttonDown;
Tk_Item *prevItemPtr;
#ifndef USE_OLD_TAG_SEARCH
SearchUids *searchUids = GetStaticUids();
@@ -4870,8 +4856,7 @@ PickCurrentItem(
* for windows.
*/
buttonDown = canvasPtr->state
& (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask);
buttonDown = canvasPtr->state & ALL_BUTTONS;
/*
* Save information about this event in the canvas. The event in the
@@ -5302,7 +5287,7 @@ CanvasFocusProc(
} else {
canvasPtr->textInfo.gotFocus = 0;
canvasPtr->textInfo.cursorOn = 0;
canvasPtr->insertBlinkHandler = (Tcl_TimerToken) NULL;
canvasPtr->insertBlinkHandler = NULL;
}
EventuallyRedrawItem(canvasPtr, canvasPtr->textInfo.focusItemPtr);
if (canvasPtr->highlightWidth > 0) {

View File

@@ -206,7 +206,7 @@ typedef struct TkCanvas {
* Miscellaneous information:
*/
Tk_Cursor cursor; /* Current cursor for window, or None. */
Tk_Cursor cursor; /* Current cursor for window, or NULL. */
char *takeFocus; /* Value of -takefocus option; not used in the
* C code, but used by keyboard traversal
* scripts. Malloc'ed, but may be NULL. */

View File

@@ -101,6 +101,7 @@ Tk_BellObjCmd(
enum options { TK_BELL_DISPLAYOF, TK_BELL_NICE };
Tk_Window tkwin = clientData;
int i, index, nice = 0;
Tk_ErrorHandler handler;
if (objc > 4) {
wrongArgs:
@@ -128,11 +129,13 @@ Tk_BellObjCmd(
break;
}
}
handler = Tk_CreateErrorHandler(Tk_Display(tkwin), -1, -1, -1, NULL, NULL);
XBell(Tk_Display(tkwin), 0);
if (!nice) {
XForceScreenSaver(Tk_Display(tkwin), ScreenSaverReset);
}
XFlush(Tk_Display(tkwin));
(void)XFlush(Tk_Display(tkwin));
Tk_DeleteErrorHandler(handler);
return TCL_OK;
}
@@ -1282,7 +1285,7 @@ Tk_WinfoObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
int index, x, y, width, height, useX, useY, class, skip;
int index, x, y, width, height, useX, useY, c_class, skip;
const char *string;
TkWindow *winPtr;
Tk_Window tkwin = clientData;
@@ -1493,7 +1496,7 @@ Tk_WinfoObjCmd(
Tcl_NewIntObj(WidthMMOfScreen(Tk_Screen(tkwin))));
break;
case WIN_SCREENVISUAL:
class = DefaultVisualOfScreen(Tk_Screen(tkwin))->class;
c_class = DefaultVisualOfScreen(Tk_Screen(tkwin))->c_class;
goto visual;
case WIN_SERVER:
TkGetServerInfo(interp, tkwin);
@@ -1521,10 +1524,10 @@ Tk_WinfoObjCmd(
break;
}
case WIN_VISUAL:
class = Tk_Visual(tkwin)->class;
c_class = Tk_Visual(tkwin)->c_class;
visual:
string = TkFindStateString(visualMap, class);
string = TkFindStateString(visualMap, c_class);
if (string == NULL) {
string = "unknown";
}
@@ -1787,15 +1790,15 @@ Tk_WinfoObjCmd(
}
resultPtr = Tcl_NewObj();
for (i = 0; i < count; i++) {
string = TkFindStateString(visualMap, visInfoPtr[i].class);
string = TkFindStateString(visualMap, visInfoPtr[i].c_class);
if (string == NULL) {
strcpy(buf, "unknown");
} else {
sprintf(buf, "%s %d", string, visInfoPtr[i].depth);
}
if (includeVisualId) {
sprintf(visualIdString, " 0x%x",
(unsigned) visInfoPtr[i].visualid);
sprintf(visualIdString, " 0x%lx",
(unsigned long) visInfoPtr[i].visualid);
strcat(buf, visualIdString);
}
strPtr = Tcl_NewStringObj(buf, -1);

View File

@@ -31,7 +31,7 @@ typedef struct {
* The structure below is used to allocate thread-local data.
*/
typedef struct ThreadSpecificData {
typedef struct {
char rgbString[20]; /* */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
@@ -245,7 +245,7 @@ Tk_GetColor(
*/
tkColPtr->magic = COLOR_MAGIC;
tkColPtr->gc = None;
tkColPtr->gc = NULL;
tkColPtr->screen = Tk_Screen(tkwin);
tkColPtr->colormap = Tk_Colormap(tkwin);
tkColPtr->visual = Tk_Visual(tkwin);
@@ -326,7 +326,7 @@ Tk_GetColorByValue(
tkColPtr = TkpGetColorByValue(tkwin, colorPtr);
tkColPtr->magic = COLOR_MAGIC;
tkColPtr->gc = None;
tkColPtr->gc = NULL;
tkColPtr->screen = Tk_Screen(tkwin);
tkColPtr->colormap = valueKey.colormap;
tkColPtr->visual = Tk_Visual(tkwin);
@@ -436,7 +436,7 @@ Tk_GCForColor(
Tcl_Panic("Tk_GCForColor called with bogus color");
}
if (tkColPtr->gc == None) {
if (tkColPtr->gc == NULL) {
gcValues.foreground = tkColPtr->color.pixel;
tkColPtr->gc = XCreateGC(DisplayOfScreen(tkColPtr->screen), drawable,
GCForeground, &gcValues);
@@ -491,9 +491,9 @@ Tk_FreeColor(
* longer any objects referencing it.
*/
if (tkColPtr->gc != None) {
if (tkColPtr->gc != NULL) {
XFreeGC(DisplayOfScreen(screen), tkColPtr->gc);
tkColPtr->gc = None;
tkColPtr->gc = NULL;
}
TkpFreeColor(tkColPtr);

View File

@@ -32,7 +32,7 @@ typedef struct TkColor {
* COLOR_MAGIC. */
GC gc; /* Simple gc with this color as foreground
* color and all other fields defaulted. May
* be None. */
* be NULL. */
Screen *screen; /* Screen where this color is valid. Used to
* delete it, and to find its display. */
Colormap colormap; /* Colormap from which this entry was

View File

@@ -31,7 +31,7 @@
* the option tables that have been created for a thread.
*/
typedef struct ThreadSpecificData {
typedef struct {
int initialized; /* 0 means table below needs initializing. */
Tcl_HashTable hashTable;
} ThreadSpecificData;
@@ -800,11 +800,11 @@ DoObjConfig(
Tk_Cursor newCursor;
if (nullOK && ObjectIsEmpty(valuePtr)) {
newCursor = None;
newCursor = NULL;
valuePtr = NULL;
} else {
newCursor = Tk_AllocCursorFromObj(interp, tkwin, valuePtr);
if (newCursor == None) {
if (newCursor == NULL) {
return TCL_ERROR;
}
}
@@ -862,7 +862,7 @@ DoObjConfig(
if (nullOK && ObjectIsEmpty(valuePtr)) {
valuePtr = NULL;
newWin = None;
newWin = NULL;
} else {
if (TkGetWindowFromObj(interp, tkwin, valuePtr,
&newWin) != TCL_OK) {
@@ -937,16 +937,13 @@ static int
ObjectIsEmpty(
Tcl_Obj *objPtr) /* Object to test. May be NULL. */
{
int length;
if (objPtr == NULL) {
return 1;
}
if (objPtr->bytes != NULL) {
return (objPtr->length == 0);
if (objPtr->bytes == NULL) {
Tcl_GetString(objPtr);
}
(void)Tcl_GetStringFromObj(objPtr, &length);
return (length == 0);
return (objPtr->length == 0);
}
/*
@@ -1669,9 +1666,9 @@ FreeResources(
break;
case TK_OPTION_CURSOR:
if (internalFormExists) {
if (*((Tk_Cursor *) internalPtr) != None) {
if (*((Tk_Cursor *) internalPtr) != NULL) {
Tk_FreeCursor(Tk_Display(tkwin), *((Tk_Cursor *) internalPtr));
*((Tk_Cursor *) internalPtr) = None;
*((Tk_Cursor *) internalPtr) = NULL;
}
} else if (objPtr != NULL) {
Tk_FreeCursorFromObj(tkwin, objPtr);
@@ -1942,7 +1939,7 @@ GetObjectForOption(
case TK_OPTION_CURSOR: {
Tk_Cursor cursor = *((Tk_Cursor *) internalPtr);
if (cursor != None) {
if (cursor != NULL) {
objPtr = Tcl_NewStringObj(
Tk_NameOfCursor(Tk_Display(tkwin), cursor), -1);
}

View File

@@ -318,7 +318,7 @@ Tk_InitConsoleChannels(
* Tk_CreateConsoleWindow --
*
* Initialize the console. This code actually creates a new application
* and associated interpreter. This effectivly hides the implementation
* and associated interpreter. This effectively hides the implementation
* from the main application.
*
* Results:
@@ -344,9 +344,13 @@ Tk_CreateConsoleWindow(
/* Init an interp with Tcl and Tk */
Tcl_Interp *consoleInterp = Tcl_CreateInterp();
if (Tcl_Init(consoleInterp) != TCL_OK) {
Tcl_Obj *result_obj = Tcl_GetObjResult(consoleInterp);
Tcl_SetObjResult(interp, result_obj);
goto error;
}
if (Tk_Init(consoleInterp) != TCL_OK) {
Tcl_Obj *result_obj = Tcl_GetObjResult(consoleInterp);
Tcl_SetObjResult(interp, result_obj);
goto error;
}

View File

@@ -150,7 +150,7 @@ Tk_AllocCursorFromObj(
cursorPtr = TkcGetCursor(interp, tkwin, Tcl_GetString(objPtr));
objPtr->internalRep.twoPtrValue.ptr1 = cursorPtr;
if (cursorPtr == NULL) {
return None;
return NULL;
}
cursorPtr->objRefCount++;
return cursorPtr->cursor;
@@ -190,7 +190,7 @@ Tk_GetCursor(
TkCursor *cursorPtr = TkcGetCursor(interp, tkwin, string);
if (cursorPtr == NULL) {
return None;
return NULL;
}
return cursorPtr->cursor;
}
@@ -388,7 +388,7 @@ Tk_GetCursorFromData(
error:
Tcl_DeleteHashEntry(dataHashPtr);
return None;
return NULL;
}
/*
@@ -425,7 +425,7 @@ Tk_NameOfCursor(
if (!dispPtr->cursorInit) {
printid:
sprintf(dispPtr->cursorString, "cursor id %p", cursor);
sprintf(dispPtr->cursorString, "cursor id 0x%" TCL_Z_MODIFIER "x", (size_t)cursor);
return dispPtr->cursorString;
}
idHashPtr = Tcl_FindHashEntry(&dispPtr->cursorIdTable, (char *) cursor);

546
generic/tkDList.h Normal file
View File

@@ -0,0 +1,546 @@
/*
* tkDList.h --
*
* A list is headed by pointers to first and last element. The elements
* are doubly linked so that an arbitrary element can be removed without
* a need to traverse the list. New elements can be added to the list
* before or after an existing element or at the head/tail of the list.
* A list may be traversed in the forward or backward direction.
*
* Copyright (c) 2018 by Gregor Cramer.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
/*
* Note that this file will not be included in header files, it is the purpose
* of this file to be included in source files only. Thus we are not using the
* prefix "Tk_" here for functions, because all the functions have private scope.
*/
/*
* -------------------------------------------------------------------------------
* Use the double linked list in the following way:
* -------------------------------------------------------------------------------
* typedef struct MyListEntry { TK_DLIST_LINKS(MyListEntry); int value; } MyListEntry;
* TK_DLIST_DEFINE(MyList, MyListEntry);
* MyList listHdr = TK_DLIST_LIST_INITIALIZER; // or MyList_Init(&listHdr)
* MyListEntry *p;
* int i = 0;
* MyList_Append(&listHdr, ckalloc(sizeof(MyListEntry)));
* MyList_Append(&listHdr, ckalloc(sizeof(MyListEntry)));
* TK_DLIST_FOREACH(p, &listHdr) { p->value = i++; }
* // ...
* MyList_RemoveHead(&listHdr);
* MyList_RemoveHead(&listHdr);
* MyList_Clear(MyListEntry, &listHdr); // invokes ckfree() for each element
* -------------------------------------------------------------------------------
* IMPORTANT NOTE: TK_DLIST_LINKS must be used at start of struct!
*/
#ifndef TK_DLIST_DEFINED
#define TK_DLIST_DEFINED
#include "tkInt.h"
/*
* List definitions.
*/
#define TK_DLIST_LINKS(ElemType) \
struct { \
struct ElemType *prev; /* previous element */ \
struct ElemType *next; /* next element */ \
} _dl_
#define TK_DLIST_LIST_INITIALIZER { NULL, NULL }
#define TK_DLIST_ELEM_INITIALIZER { NULL, NULL }
/*************************************************************************/
/*
* DList_Init: Initialize list header. This can also be used to clear the
* list.
*
* See also: DList_Clear()
*/
/*************************************************************************/
/*
* DList_ElemInit: Initialize a list element.
*/
/*************************************************************************/
/*
* DList_InsertAfter: Insert 'elem' after 'listElem'. 'elem' must not
* be linked, but 'listElem' must be linked.
*/
/*************************************************************************/
/*
* DList_InsertBefore: Insert 'elem' before 'listElem'. 'elem' must not
* be linked, but 'listElem' must be linked.
*/
/*************************************************************************/
/*
* DList_Prepend: Insert 'elem' at start of list. This element must not
* be linked.
*
* See also: DList_Append()
*/
/*************************************************************************/
/*
* DList_Append: Append 'elem' to end of list. This element must not
* be linked.
*
* See also: DList_Prepend()
*/
/*************************************************************************/
/*
* DList_Move: Append all list items of 'src' to end of 'dst'.
*/
/*************************************************************************/
/*
* DList_Remove: Remove 'elem' from list. This element must be linked.
*
* See also: DList_Free()
*/
/*************************************************************************/
/*
* DList_Free: Remove 'elem' from list and free it. This element must
* be linked.
*
* See also: DList_Remove()
*/
/*************************************************************************/
/*
* DList_RemoveHead: Remove first element from list. The list must
* not be empty.
*
* See also: DList_FreeHead()
*/
/*************************************************************************/
/*
* DList_RemoveTail: Remove last element from list. The list must
* not be empty.
*
* See also: DList_FreeTail()
*/
/*************************************************************************/
/*
* DList_FreeHead: Remove first element from list and free it.
* The list must not be empty.
*
* See also: DList_RemoveHead()
*/
/*************************************************************************/
/*
* DList_FreeTail: Remove last element from list and free it.
* The list must not be empty.
*
* See also: DList_RemoveTail()
*/
/*************************************************************************/
/*
* DList_SwapElems: Swap positions of given elements 'lhs' and 'rhs'.
* Both elements must be linked, and must belong to same list.
*/
/*************************************************************************/
/*
* DList_Clear: Clear whole list and free all elements.
*
* See also: DList_Init
*/
/*************************************************************************/
/*
* DList_Traverse: Iterate over all elements in list from first to last.
* Call given function func(head, elem) for each element. The function has
* to return the next element in list to traverse, normally this is
* DList_Next(elem).
*
* See also: TK_DLIST_FOREACH, TK_DLIST_FOREACH_REVERSE
*/
/*************************************************************************/
/*
* DList_First: Return pointer of first element in list, maybe it's NULL.
*/
/*************************************************************************/
/*
* DList_Last: Return pointer of last element in list, maybe it's NULL.
*/
/*************************************************************************/
/*
* DList_Next: Return pointer of next element after 'elem', maybe it's NULL.
*
* See also: DList_Prev()
*/
/*************************************************************************/
/*
* DList_Prev: Return pointer of previous element before 'elem', maybe it's
* NULL.
*
* See also: DList_Next()
*/
/*************************************************************************/
/*
* DList_IsEmpty: Test whether given list is empty.
*/
/*************************************************************************/
/*
* DList_IsLinked: Test whether given element is linked.
*/
/*************************************************************************/
/*
* DList_IsFirst: Test whether given element is first element in list.
* Note that 'elem' must be linked.
*
* See also: DList_IsLast(), DList_IsLinked()
*/
/*************************************************************************/
/*
* DList_IsLast: Test whether given element is last element in list.
* Note that 'elem' must be linked.
*
* See also: DList_IsFirst(), DList_IsLinked()
*/
/*************************************************************************/
/*
* DList_Size: Count number of elements in given list.
*/
/*************************************************************************/
/*
* TK_DLIST_FOREACH: Iterate over all elements in list from first to last.
* 'var' is the name of the variable which points to current element.
*
* See also: TK_DLIST_FOREACH_REVERSE, DList_Traverse()
*/
/*************************************************************************/
/*
* TK_DLIST_FOREACH_REVERSE: Iterate over all elements in list from last
* to first (backwards). 'var' is the name of the variable which points to
* current element.
*/
/*************************************************************************/
#if defined(__GNUC__) || defined(__clang__)
# define __TK_DLIST_UNUSED __attribute__((unused))
#else
# define __TK_DLIST_UNUSED
#endif
#define TK_DLIST_DEFINE(LT, ElemType) /* LT = type of head/list */ \
/* ------------------------------------------------------------------------- */ \
typedef struct LT { \
struct ElemType *first; /* first element */ \
struct ElemType *last; /* last element */ \
} LT; \
\
typedef struct ElemType *(LT##_Func)(LT *head, struct ElemType *elem); \
\
__TK_DLIST_UNUSED \
static void \
LT##_Init(LT *head) \
{ \
assert(head); \
head->first = NULL; \
head->last = NULL; \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_ElemInit(struct ElemType *elem) \
{ \
assert(elem); \
elem->_dl_.next = NULL; \
elem->_dl_.prev = NULL; \
} \
\
__TK_DLIST_UNUSED \
static int \
LT##_IsEmpty(LT *head) \
{ \
assert(head); \
return head->first == NULL; \
} \
\
__TK_DLIST_UNUSED \
static int \
LT##_IsLinked(struct ElemType *elem) \
{ \
assert(elem); \
return elem->_dl_.next && elem->_dl_.prev; \
} \
\
__TK_DLIST_UNUSED \
static int \
LT##_IsFirst(struct ElemType *elem) \
{ \
assert(LT##_IsLinked(elem)); \
return elem->_dl_.prev->_dl_.prev == elem; \
} \
\
__TK_DLIST_UNUSED \
static int \
LT##_IsLast(struct ElemType *elem) \
{ \
assert(LT##_IsLinked(elem)); \
return elem->_dl_.next->_dl_.next == elem; \
} \
\
__TK_DLIST_UNUSED \
static struct ElemType * \
LT##_First(LT *head) \
{ \
assert(head); \
return head->first; \
} \
\
__TK_DLIST_UNUSED \
static struct ElemType * \
LT##_Last(LT *head) \
{ \
assert(head); \
return head->last; \
} \
\
__TK_DLIST_UNUSED \
static struct ElemType * \
LT##_Next(struct ElemType *elem) \
{ \
assert(elem); \
return LT##_IsLast(elem) ? NULL : elem->_dl_.next; \
} \
\
__TK_DLIST_UNUSED \
static struct ElemType * \
LT##_Prev(struct ElemType *elem) \
{ \
assert(elem); \
return LT##_IsFirst(elem) ? NULL : elem->_dl_.prev; \
} \
\
__TK_DLIST_UNUSED \
static unsigned \
LT##_Size(const LT *head) \
{ \
const struct ElemType *elem; \
unsigned size = 0; \
assert(head); \
if ((elem = head->first)) { \
for ( ; elem != (void *) head; elem = elem->_dl_.next) { \
++size; \
} \
} \
return size; \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_InsertAfter(struct ElemType *listElem, struct ElemType *elem) \
{ \
assert(listElem); \
assert(elem); \
elem->_dl_.next = listElem->_dl_.next; \
elem->_dl_.prev = listElem; \
listElem->_dl_.next->_dl_.prev = elem; \
listElem->_dl_.next = elem; \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_InsertBefore(struct ElemType *listElem, struct ElemType *elem) \
{ \
assert(listElem); \
assert(elem); \
elem->_dl_.next = listElem; \
elem->_dl_.prev = listElem->_dl_.prev;; \
listElem->_dl_.prev->_dl_.next = elem; \
listElem->_dl_.prev = elem; \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_Prepend(LT *head, struct ElemType *elem) \
{ \
assert(head); \
assert(elem); \
elem->_dl_.prev = (void *) head; \
if (!head->first) { \
elem->_dl_.next = (void *) head; \
head->last = elem; \
} else { \
elem->_dl_.next = head->first; \
head->first->_dl_.prev = elem; \
} \
head->first = elem; \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_Append(LT *head, struct ElemType *elem) \
{ \
assert(head); \
assert(elem); \
elem->_dl_.next = (void *) head; \
if (!head->first) { \
elem->_dl_.prev = (void *) head; \
head->first = elem; \
} else { \
elem->_dl_.prev = head->last; \
head->last->_dl_.next = elem; \
} \
head->last = elem; \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_Move(LT *dst, LT *src) \
{ \
assert(dst); \
assert(src); \
if (src->first) { \
if (dst->first) { \
dst->last->_dl_.next = src->first; \
src->first->_dl_.prev = dst->last; \
dst->last = src->last; \
} else { \
*dst = *src; \
dst->first->_dl_.prev = (void *) dst; \
} \
dst->last->_dl_.next = (void *) dst; \
LT##_Init(src); \
} \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_Remove(struct ElemType *elem) \
{ \
int isFirst, isLast; \
assert(LT##_IsLinked(elem)); \
isFirst = LT##_IsFirst(elem); \
isLast = LT##_IsLast(elem); \
if (isFirst && isLast) { \
((LT *) elem->_dl_.prev)->first = NULL; \
((LT *) elem->_dl_.next)->last = NULL; \
} else { \
if (isFirst) { \
((LT *) elem->_dl_.prev)->first = elem->_dl_.next; \
} else { \
elem->_dl_.prev->_dl_.next = elem->_dl_.next; \
} \
if (isLast) { \
((LT *) elem->_dl_.next)->last = elem->_dl_.prev; \
} else { \
elem->_dl_.next->_dl_.prev = elem->_dl_.prev; \
} \
} \
LT##_ElemInit(elem); \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_Free(struct ElemType *elem) \
{ \
LT##_Remove(elem); \
ckfree((void *) elem); \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_RemoveHead(LT *head) \
{ \
assert(!LT##_IsEmpty(head)); \
LT##_Remove(head->first); \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_RemoveTail(LT *head) \
{ \
assert(!LT##_IsEmpty(head)); \
LT##_Remove(head->last); \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_FreeHead(LT *head) \
{ \
assert(!LT##_IsEmpty(head)); \
LT##_Free(head->first); \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_FreeTail(LT *head) \
{ \
assert(!LT##_IsEmpty(head)); \
LT##_Free(head->last); \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_SwapElems(struct ElemType *lhs, struct ElemType *rhs) \
{ \
assert(lhs); \
assert(rhs); \
if (lhs != rhs) { \
struct ElemType tmp; \
if (LT##_IsFirst(lhs)) { \
((LT *) lhs->_dl_.prev)->first = rhs; \
} else if (LT##_IsFirst(rhs)) { \
((LT *) rhs->_dl_.prev)->first = lhs; \
} \
if (LT##_IsLast(lhs)) { \
((LT *) lhs->_dl_.next)->last = rhs; \
} else if (LT##_IsLast(rhs)) { \
((LT *) rhs->_dl_.next)->last = lhs; \
} \
tmp._dl_ = lhs->_dl_; \
lhs->_dl_ = rhs->_dl_; \
rhs->_dl_ = tmp._dl_; \
} \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_Clear(LT *head) \
{ \
struct ElemType *p; \
struct ElemType *next; \
assert(head); \
for (p = head->first; p; p = next) { \
next = LT##_Next(p); \
ckfree((void *) p); \
} \
LT##_Init(head); \
} \
\
__TK_DLIST_UNUSED \
static void \
LT##_Traverse(LT *head, LT##_Func func) \
{ \
struct ElemType *next; \
struct ElemType *p; \
assert(head); \
for (p = head->first; p; p = next) { \
next = func(head, p); \
} \
} \
/* ------------------------------------------------------------------------- */
#define TK_DLIST_FOREACH(var, head) \
assert(head); \
for (var = head->first ? head->first : (void *) head; var != (void *) head; var = var->_dl_.next)
#define TK_DLIST_FOREACH_REVERSE(var, head) \
assert(head); \
for (var = head->last ? head->last : (void *) head; var != (void *) head; var = var->_dl_.prev)
#endif /* TK_DLIST_DEFINED */
/*
* Local Variables:
* mode: c
* c-basic-offset: 4
* fill-column: 105
* End:
* vi:set ts=8 sw=4:
*/

View File

@@ -524,16 +524,16 @@ Tk_EntryObjCmd(
entryPtr->selectFirst = -1;
entryPtr->selectLast = -1;
entryPtr->cursor = None;
entryPtr->cursor = NULL;
entryPtr->exportSelection = 1;
entryPtr->justify = TK_JUSTIFY_LEFT;
entryPtr->relief = TK_RELIEF_FLAT;
entryPtr->state = STATE_NORMAL;
entryPtr->displayString = entryPtr->string;
entryPtr->inset = XPAD;
entryPtr->textGC = None;
entryPtr->selTextGC = None;
entryPtr->highlightGC = None;
entryPtr->textGC = NULL;
entryPtr->selTextGC = NULL;
entryPtr->highlightGC = NULL;
entryPtr->avgWidth = 1;
entryPtr->validate = VALIDATE_NONE;
@@ -887,7 +887,8 @@ EntryWidgetObjCmd(
entryPtr->selectLast = index2;
}
if (!(entryPtr->flags & GOT_SELECTION)
&& (entryPtr->exportSelection)) {
&& (entryPtr->exportSelection)
&& (!Tcl_IsSafe(entryPtr->interp))) {
Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY,
EntryLostSelection, entryPtr);
entryPtr->flags |= GOT_SELECTION;
@@ -1032,10 +1033,10 @@ DestroyEntry(
EntryTextVarProc, entryPtr);
entryPtr->flags &= ~ENTRY_VAR_TRACED;
}
if (entryPtr->textGC != None) {
if (entryPtr->textGC != NULL) {
Tk_FreeGC(entryPtr->display, entryPtr->textGC);
}
if (entryPtr->selTextGC != None) {
if (entryPtr->selTextGC != NULL) {
Tk_FreeGC(entryPtr->display, entryPtr->selTextGC);
}
Tcl_DeleteTimerHandler(entryPtr->insertBlinkHandler);
@@ -1122,7 +1123,7 @@ ConfigureEntry(
* value.
*/
oldExport = entryPtr->exportSelection;
oldExport = (entryPtr->exportSelection) && (!Tcl_IsSafe(entryPtr->interp));
if (entryPtr->type == TK_SPINBOX) {
oldValues = sbPtr->valueStr;
oldFormat = sbPtr->reqFormat;
@@ -1276,6 +1277,7 @@ ConfigureEntry(
*/
if (entryPtr->exportSelection && (!oldExport)
&& (!Tcl_IsSafe(entryPtr->interp))
&& (entryPtr->selectFirst != -1)
&& !(entryPtr->flags & GOT_SELECTION)) {
Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY, EntryLostSelection,
@@ -1428,7 +1430,7 @@ EntryWorldChanged(
ClientData instanceData) /* Information about widget. */
{
XGCValues gcValues;
GC gc = None;
GC gc = NULL;
unsigned long mask;
Tk_3DBorder border;
XColor *colorPtr;
@@ -1480,7 +1482,7 @@ EntryWorldChanged(
gcValues.graphics_exposures = False;
mask = GCForeground | GCFont | GCGraphicsExposures;
gc = Tk_GetGC(entryPtr->tkwin, mask, &gcValues);
if (entryPtr->textGC != None) {
if (entryPtr->textGC != NULL) {
Tk_FreeGC(entryPtr->display, entryPtr->textGC);
}
entryPtr->textGC = gc;
@@ -1491,7 +1493,7 @@ EntryWorldChanged(
gcValues.font = Tk_FontId(entryPtr->tkfont);
mask = GCForeground | GCFont;
gc = Tk_GetGC(entryPtr->tkwin, mask, &gcValues);
if (entryPtr->selTextGC != None) {
if (entryPtr->selTextGC != NULL) {
Tk_FreeGC(entryPtr->display, entryPtr->selTextGC);
}
entryPtr->selTextGC = gc;
@@ -1511,17 +1513,15 @@ EntryWorldChanged(
*
* TkpDrawEntryBorderAndFocus --
*
* This function redraws the border of an entry widget. It overrides the
* generic border drawing code if the entry widget parameters are such
* that the native widget drawing is a good fit. This version just
* returns 0, so platforms that don't do special native drawing don't
* have to implement it.
* Stub function for Tk on platforms other than Aqua
* (Windows and X11), which do not draw native entry borders.
* See macosx/tkMacOSXEntry.c for function definition in Tk Aqua.
*
* Results:
* 1 if it has drawn the border, 0 if not.
* Returns 0.
*
* Side effects:
* May draw the entry border into pixmap.
* None.
*
*--------------------------------------------------------------
*/
@@ -1540,17 +1540,15 @@ TkpDrawEntryBorderAndFocus(
*
* TkpDrawSpinboxButtons --
*
* This function redraws the buttons of an spinbox widget. It overrides
* the generic button drawing code if the spinbox widget parameters are
* such that the native widget drawing is a good fit. This version just
* returns 0, so platforms that don't do special native drawing don't
* have to implement it.
* Stub function for Tk on platforms other than Aqua
* (Windows and X11), which do not draw native spinbox buttons.
* See macosx/tkMacOSXEntry.c for function definition in Tk Aqua.
*
* Results:
* 1 if it has drawn the border, 0 if not.
* Returns 0.
*
* Side effects:
* May draw the entry border into pixmap.
* None.
*
*--------------------------------------------------------------
*/
@@ -1924,8 +1922,8 @@ EntryComputeGeometry(
*/
if (entryPtr->showChar != NULL) {
Tcl_UniChar ch;
char buf[TCL_UTF_MAX];
int ch;
char buf[6];
int size;
/*
@@ -1935,15 +1933,16 @@ EntryComputeGeometry(
* resulting string.
*/
Tcl_UtfToUniChar(entryPtr->showChar, &ch);
size = Tcl_UniCharToUtf(ch, buf);
TkUtfToUniChar(entryPtr->showChar, &ch);
size = TkUniCharToUtf(ch, buf);
entryPtr->numDisplayBytes = entryPtr->numChars * size;
p = ckalloc(entryPtr->numDisplayBytes + 1);
entryPtr->displayString = p;
for (i = entryPtr->numChars; --i >= 0; ) {
p += Tcl_UniCharToUtf(ch, p);
memcpy(p, buf, size);
p += size;
}
*p = '\0';
}
@@ -2454,9 +2453,9 @@ EntryEventProc(
} else if ((elem == SEL_BUTTONDOWN) || (elem == SEL_BUTTONUP)) {
cursor = sbPtr->bCursor;
} else {
cursor = None;
cursor = NULL;
}
if (cursor != None) {
if (cursor != NULL) {
Tk_DefineCursor(entryPtr->tkwin, cursor);
} else {
Tk_UndefineCursor(entryPtr->tkwin);
@@ -2744,7 +2743,8 @@ EntrySelectTo(
* Grab the selection if we don't own it already.
*/
if (!(entryPtr->flags & GOT_SELECTION) && (entryPtr->exportSelection)) {
if (!(entryPtr->flags & GOT_SELECTION) && (entryPtr->exportSelection)
&& (!Tcl_IsSafe(entryPtr->interp))) {
Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY, EntryLostSelection,
entryPtr);
entryPtr->flags |= GOT_SELECTION;
@@ -2811,7 +2811,8 @@ EntryFetchSelection(
const char *string;
const char *selStart, *selEnd;
if ((entryPtr->selectFirst < 0) || !(entryPtr->exportSelection)) {
if ((entryPtr->selectFirst < 0) || (!entryPtr->exportSelection)
|| Tcl_IsSafe(entryPtr->interp)) {
return -1;
}
string = entryPtr->displayString;
@@ -2864,7 +2865,8 @@ EntryLostSelection(
*/
if (TkpAlwaysShowSelection(entryPtr->tkwin)
&& (entryPtr->selectFirst >= 0) && entryPtr->exportSelection) {
&& (entryPtr->selectFirst >= 0) && entryPtr->exportSelection
&& (!Tcl_IsSafe(entryPtr->interp))) {
entryPtr->selectFirst = -1;
entryPtr->selectLast = -1;
EventuallyRedraw(entryPtr);
@@ -3149,14 +3151,34 @@ EntryTextVarProc(
*/
if (flags & TCL_TRACE_UNSETS) {
if ((flags & TCL_TRACE_DESTROYED) && !(flags & TCL_INTERP_DESTROYED)) {
if (!Tcl_InterpDeleted(interp) && entryPtr->textVarName) {
ClientData probe = NULL;
do {
probe = Tcl_VarTraceInfo(interp,
entryPtr->textVarName,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
EntryTextVarProc, probe);
if (probe == (ClientData)entryPtr) {
break;
}
} while (probe);
if (probe) {
/*
* We were able to fetch the unset trace for our
* textVarName, which means it is not unset and not
* the cause of this unset trace. Instead some outdated
* former variable must be, and we should ignore it.
*/
return NULL;
}
Tcl_SetVar2(interp, entryPtr->textVarName, NULL,
entryPtr->string, TCL_GLOBAL_ONLY);
Tcl_TraceVar2(interp, entryPtr->textVarName, NULL,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
EntryTextVarProc, clientData);
entryPtr->flags |= ENTRY_VAR_TRACED;
}
}
return NULL;
}
@@ -3411,7 +3433,7 @@ ExpandPercents(
* list element. */
int number, length;
register const char *string;
Tcl_UniChar ch;
int ch;
char numStorage[2*TCL_INTEGER_SPACE];
while (1) {
@@ -3444,7 +3466,7 @@ ExpandPercents(
before++; /* skip over % */
if (*before != '\0') {
before += Tcl_UtfToUniChar(before, &ch);
before += TkUtfToUniChar(before, &ch);
} else {
ch = '%';
}
@@ -3464,7 +3486,7 @@ ExpandPercents(
string = Tk_PathName(entryPtr->tkwin);
break;
default:
length = Tcl_UniCharToUtf(ch, numStorage);
length = TkUniCharToUtf(ch, numStorage);
numStorage[length] = '\0';
string = numStorage;
break;
@@ -3524,7 +3546,7 @@ ExpandPercents(
string = Tk_PathName(entryPtr->tkwin);
break;
default:
length = Tcl_UniCharToUtf(ch, numStorage);
length = TkUniCharToUtf(ch, numStorage);
numStorage[length] = '\0';
string = numStorage;
break;
@@ -3614,22 +3636,22 @@ Tk_SpinboxObjCmd(
entryPtr->selectFirst = -1;
entryPtr->selectLast = -1;
entryPtr->cursor = None;
entryPtr->cursor = NULL;
entryPtr->exportSelection = 1;
entryPtr->justify = TK_JUSTIFY_LEFT;
entryPtr->relief = TK_RELIEF_FLAT;
entryPtr->state = STATE_NORMAL;
entryPtr->displayString = entryPtr->string;
entryPtr->inset = XPAD;
entryPtr->textGC = None;
entryPtr->selTextGC = None;
entryPtr->highlightGC = None;
entryPtr->textGC = NULL;
entryPtr->selTextGC = NULL;
entryPtr->highlightGC = NULL;
entryPtr->avgWidth = 1;
entryPtr->validate = VALIDATE_NONE;
sbPtr->selElement = SEL_NONE;
sbPtr->curElement = SEL_NONE;
sbPtr->bCursor = None;
sbPtr->bCursor = NULL;
sbPtr->repeatDelay = 400;
sbPtr->repeatInterval = 100;
sbPtr->fromValue = 0.0;
@@ -4033,7 +4055,8 @@ SpinboxWidgetObjCmd(
entryPtr->selectLast = index2;
}
if (!(entryPtr->flags & GOT_SELECTION)
&& entryPtr->exportSelection) {
&& entryPtr->exportSelection
&& (!Tcl_IsSafe(entryPtr->interp))) {
Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY,
EntryLostSelection, entryPtr);
entryPtr->flags |= GOT_SELECTION;

View File

@@ -82,7 +82,7 @@ typedef struct {
* in readonly state, plus used for
* background. */
int borderWidth; /* Width of 3-D border around window. */
Tk_Cursor cursor; /* Current cursor for window, or None. */
Tk_Cursor cursor; /* Current cursor for window, or NULL. */
int exportSelection; /* Non-zero means tie internal entry selection
* to X selection. */
Tk_Font tkfont; /* Information about text font, or NULL. */
@@ -192,7 +192,7 @@ typedef struct {
Tk_3DBorder activeBorder; /* Used for drawing border around active
* buttons. */
Tk_3DBorder buttonBorder; /* Used for drawing border around buttons. */
Tk_Cursor bCursor; /* cursor for buttons, or None. */
Tk_Cursor bCursor; /* cursor for buttons, or NULL. */
int bdRelief; /* 3-D effect: TK_RELIEF_RAISED, etc. */
int buRelief; /* 3-D effect: TK_RELIEF_RAISED, etc. */
char *command; /* Command to invoke for spin buttons. NULL
@@ -221,7 +221,7 @@ typedef struct {
* value that the users requests. Malloc'ed */
char *valueFormat; /* Sprintf conversion specifier used for the
* value. */
char digitFormat[10]; /* Sprintf conversion specifier computed from
char digitFormat[16]; /* Sprintf conversion specifier computed from
* digits and other information; used for the
* value. */

View File

@@ -82,8 +82,8 @@ Tk_CreateErrorHandler(
* errors. */
ClientData clientData) /* Arbitrary value to pass to errorProc. */
{
register TkErrorHandler *errorPtr;
register TkDisplay *dispPtr;
TkErrorHandler *errorPtr;
TkDisplay *dispPtr;
/*
* Find the display. If Tk doesn't know about this display then it's an
@@ -147,8 +147,8 @@ Tk_DeleteErrorHandler(
Tk_ErrorHandler handler) /* Token for handler to delete; was previous
* return value from Tk_CreateErrorHandler. */
{
register TkErrorHandler *errorPtr = (TkErrorHandler *) handler;
register TkDisplay *dispPtr = errorPtr->dispPtr;
TkErrorHandler *errorPtr = (TkErrorHandler *) handler;
TkDisplay *dispPtr = errorPtr->dispPtr;
errorPtr->lastRequest = NextRequest(dispPtr->display) - 1;
@@ -166,12 +166,20 @@ Tk_DeleteErrorHandler(
dispPtr->deleteCount += 1;
if (dispPtr->deleteCount >= 10) {
register TkErrorHandler *prevPtr;
TkErrorHandler *prevPtr;
TkErrorHandler *nextPtr;
int lastSerial;
int lastSerial = LastKnownRequestProcessed(dispPtr->display);
/*
* Last chance to catch errors for this handler: if no event/error
* processing took place to follow up the end of this error handler
* we need a round trip with the X server now.
*/
if (errorPtr->lastRequest > (unsigned long) lastSerial) {
XSync(dispPtr->display, False);
}
dispPtr->deleteCount = 0;
lastSerial = LastKnownRequestProcessed(dispPtr->display);
errorPtr = dispPtr->errorPtr;
for (prevPtr = NULL; errorPtr != NULL; errorPtr = nextPtr) {
nextPtr = errorPtr->nextPtr;
@@ -213,11 +221,11 @@ Tk_DeleteErrorHandler(
static int
ErrorProc(
Display *display, /* Display for which error occurred. */
register XErrorEvent *errEventPtr)
XErrorEvent *errEventPtr)
/* Information about error. */
{
register TkDisplay *dispPtr;
register TkErrorHandler *errorPtr;
TkDisplay *dispPtr;
TkErrorHandler *errorPtr;
/*
* See if we know anything about the display. If not, then invoke the

View File

@@ -139,7 +139,7 @@ typedef struct ExitHandler {
* storage for the current thread.
*/
typedef struct ThreadSpecificData {
typedef struct {
int handlersActive; /* The following variable has a non-zero value
* when a handler is active. */
InProgress *pendingPtr; /* Topmost search in progress, or NULL if
@@ -193,7 +193,6 @@ TCL_DECLARE_MUTEX(exitMutex)
static void CleanUpTkEvent(XEvent *eventPtr);
static void DelayedMotionProc(ClientData clientData);
static int GetButtonMask(unsigned int Button);
static unsigned long GetEventMaskFromXEvent(XEvent *eventPtr);
static TkWindow * GetTkWindowFromXEvent(XEvent *eventPtr);
static void InvokeClientMessageHandlers(ThreadSpecificData *tsdPtr,
@@ -208,7 +207,6 @@ static Window ParentXId(Display *display, Window w);
static int RefreshKeyboardMappingIfNeeded(XEvent *eventPtr);
static int TkXErrorHandler(ClientData clientData,
XErrorEvent *errEventPtr);
static void UpdateButtonEventState(XEvent *eventPtr);
static int WindowEventProc(Tcl_Event *evPtr, int flags);
#ifdef TK_USE_INPUT_METHODS
static void CreateXIC(TkWindow *winPtr);
@@ -356,6 +354,7 @@ CreateXIC(
/* XCreateIC failed. */
return;
}
winPtr->ximGeneration = dispPtr->ximGeneration;
/*
* Adjust the window's event mask if the IM requires it.
@@ -523,7 +522,7 @@ RefreshKeyboardMappingIfNeeded(
/*
*----------------------------------------------------------------------
*
* GetButtonMask --
* TkGetButtonMask --
*
* Return the proper Button${n}Mask for the button.
*
@@ -536,88 +535,15 @@ RefreshKeyboardMappingIfNeeded(
*----------------------------------------------------------------------
*/
static int
GetButtonMask(
static const unsigned long buttonMasks[] = {
0, Button1Mask, Button2Mask, Button3Mask, Button4Mask, Button5Mask
};
unsigned long
TkGetButtonMask(
unsigned int button)
{
switch (button) {
case 1:
return Button1Mask;
case 2:
return Button2Mask;
case 3:
return Button3Mask;
case 4:
return Button4Mask;
case 5:
return Button5Mask;
}
return 0;
}
/*
*----------------------------------------------------------------------
*
* UpdateButtonEventState --
*
* Update the button event state in our TkDisplay using the XEvent
* passed. We also may modify the the XEvent passed to fit some aspects
* of our TkDisplay.
*
* Results:
* None.
*
* Side effects:
* The TkDisplay's private button state may be modified. The eventPtr's
* state may be updated to reflect masks stored in our TkDisplay that the
* event doesn't contain. The eventPtr may also be modified to not
* contain a button state for the window in which it was not pressed in.
*
*----------------------------------------------------------------------
*/
static void
UpdateButtonEventState(
XEvent *eventPtr)
{
TkDisplay *dispPtr;
int allButtonsMask = Button1Mask | Button2Mask | Button3Mask
| Button4Mask | Button5Mask;
switch (eventPtr->type) {
case ButtonPress:
dispPtr = TkGetDisplay(eventPtr->xbutton.display);
dispPtr->mouseButtonWindow = eventPtr->xbutton.window;
eventPtr->xbutton.state |= dispPtr->mouseButtonState;
dispPtr->mouseButtonState |= GetButtonMask(eventPtr->xbutton.button);
break;
case ButtonRelease:
dispPtr = TkGetDisplay(eventPtr->xbutton.display);
dispPtr->mouseButtonWindow = None;
dispPtr->mouseButtonState &= ~GetButtonMask(eventPtr->xbutton.button);
eventPtr->xbutton.state |= dispPtr->mouseButtonState;
break;
case MotionNotify:
dispPtr = TkGetDisplay(eventPtr->xmotion.display);
if (dispPtr->mouseButtonState & allButtonsMask) {
if (eventPtr->xbutton.window != dispPtr->mouseButtonWindow) {
/*
* This motion event should not be interpreted as a button
* press + motion event since this is not the same window the
* button was pressed down in.
*/
dispPtr->mouseButtonState &= ~allButtonsMask;
dispPtr->mouseButtonWindow = None;
} else {
eventPtr->xmotion.state |= dispPtr->mouseButtonState;
}
}
break;
}
return (button > Button5) ? 0 : buttonMasks[button];
}
/*
@@ -1219,7 +1145,13 @@ Tk_HandleEvent(
ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
UpdateButtonEventState(eventPtr);
#if !defined(MAC_OSX_TK) && !defined(_WIN32)
if (((eventPtr->type == ButtonPress) || (eventPtr->type == ButtonRelease))
&& ((eventPtr->xbutton.button - 6) < 2)) {
eventPtr->xbutton.button -= 2;
eventPtr->xbutton.state ^= ShiftMask;
}
#endif
/*
* If the generic handler processed this event we are done and can return.
@@ -1288,6 +1220,14 @@ Tk_HandleEvent(
*/
#ifdef TK_USE_INPUT_METHODS
/*
* If the XIC has been invalidated, it must be recreated.
*/
if (winPtr->dispPtr->ximGeneration != winPtr->ximGeneration) {
winPtr->flags &= ~TK_CHECKED_IC;
winPtr->inputContext = NULL;
}
if ((winPtr->dispPtr->flags & TK_DISPLAY_USE_IM)) {
if (!(winPtr->flags & (TK_CHECKED_IC|TK_ALREADY_DEAD))) {
winPtr->flags |= TK_CHECKED_IC;
@@ -1295,7 +1235,9 @@ Tk_HandleEvent(
CreateXIC(winPtr);
}
}
if (eventPtr->type == FocusIn && winPtr->inputContext != NULL) {
if ((eventPtr->type == FocusIn) &&
(winPtr->dispPtr->inputMethod != NULL) &&
(winPtr->inputContext != NULL)) {
XSetICFocus(winPtr->inputContext);
}
}
@@ -1357,7 +1299,7 @@ Tk_HandleEvent(
* handle CreateNotify events, so we gotta pass 'em through.
*/
if ((ip.winPtr != None)
if ((ip.winPtr != NULL)
&& ((mask != SubstructureNotifyMask)
|| (eventPtr->type == CreateNotify))) {
TkBindEventProc(winPtr, eventPtr);
@@ -1428,7 +1370,7 @@ TkEventDeadWindow(
ipPtr->nextHandler = NULL;
}
if (ipPtr->winPtr == winPtr) {
ipPtr->winPtr = None;
ipPtr->winPtr = NULL;
}
}
ckfree(handlerPtr);

View File

@@ -279,8 +279,8 @@ TkFocusFilterEvent(
* pass the event through to Tk bindings.
*/
if (eventPtr->xfocus.send_event == GENERATED_FOCUS_EVENT_MAGIC) {
eventPtr->xfocus.send_event = 0;
if ((eventPtr->xfocus.send_event & GENERATED_FOCUS_EVENT_MAGIC) == GENERATED_FOCUS_EVENT_MAGIC) {
eventPtr->xfocus.send_event &= ~GENERATED_FOCUS_EVENT_MAGIC;
return 1;
}
@@ -551,12 +551,17 @@ TkSetFocusWin(
return;
}
/*
* Get the current focus window with the same display and application
* as winPtr.
*/
displayFocusPtr = FindDisplayFocusInfo(winPtr->mainPtr, winPtr->dispPtr);
/*
* If force is set, we should make sure we grab the focus regardless of
* the current focus window since under Windows, we may need to take
* control away from another application.
* Do nothing if the window already has focus and force is not set. If
* force is set, we need to grab the focus, since under Windows or macOS
* this may involve taking control away from another application.
*/
if (winPtr == displayFocusPtr->focusWinPtr && !force) {
@@ -564,14 +569,15 @@ TkSetFocusWin(
}
/*
* Find the top-level window for winPtr, then find (or create) a record
* for the top-level. Also see whether winPtr and all its ancestors are
* Find the toplevel window for winPtr, then find (or create) a record
* for the toplevel. Also see whether winPtr and all its ancestors are
* mapped.
*/
allMapped = 1;
for (topLevelPtr = winPtr; ; topLevelPtr = topLevelPtr->parentPtr) {
if (topLevelPtr == NULL) {
/*
* The window is being deleted. No point in worrying about giving
* it the focus.
@@ -588,11 +594,11 @@ TkSetFocusWin(
}
/*
* If the new focus window isn't mapped, then we can't focus on it (X will
* generate an error, for example). Instead, create an event handler that
* will set the focus to this window once it gets mapped. At the same
* time, delete any old handler that might be around; it's no longer
* relevant.
* If any ancestor of the new focus window isn't mapped, then we can't set
* focus for it (X will generate an error, for example). Instead, create
* an event handler that will set the focus to this window once it gets
* mapped. At the same time, delete any old handler that might be around;
* it's no longer relevant.
*/
if (displayFocusPtr->focusOnMapPtr != NULL) {
@@ -623,28 +629,37 @@ TkSetFocusWin(
}
tlFocusPtr->focusWinPtr = winPtr;
/*
* Reset the window system's focus window and generate focus events, with
* two special cases:
*
* 1. If the application is embedded and doesn't currently have the focus,
* don't set the focus directly. Instead, see if the embedding code can
* claim the focus from the enclosing container.
* 2. Otherwise, if the application doesn't currently have the focus,
* don't change the window system's focus unless it was already in this
* application or "force" was specified.
*/
if (topLevelPtr->flags & TK_EMBEDDED &&
(displayFocusPtr->focusWinPtr == NULL)) {
/*
* We are assigning focus to an embedded toplevel. The platform
* specific function TkpClaimFocus needs to handle the job of
* assigning focus to the container, since we have no way to find the
* contaiuner.
*/
if ((topLevelPtr->flags & TK_EMBEDDED)
&& (displayFocusPtr->focusWinPtr == NULL)) {
TkpClaimFocus(topLevelPtr, force);
} else if ((displayFocusPtr->focusWinPtr != NULL) || force) {
/*
* Generate events to shift focus between Tk windows. We do this
* regardless of what TkpChangeFocus does with the real X focus so
* that Tk widgets track focus commands when there is no window
* manager. GenerateFocusEvents will set up a serial number marker so
* we discard focus events that are triggered by the ChangeFocus.
* If we are forcing removal of focus from a container hosting a
* toplevel from a different application, clear the focus in that
* application.
*/
if (force) {
TkWindow *focusPtr = winPtr->dispPtr->focusPtr;
if (focusPtr && focusPtr->mainPtr != winPtr->mainPtr) {
DisplayFocusInfo *displayFocusPtr2 = FindDisplayFocusInfo(
focusPtr->mainPtr, focusPtr->dispPtr);
displayFocusPtr2->focusWinPtr = NULL;
}
}
/*
* Call the platform specific function TkpChangeFocus to move the
* window manager's focus to a new toplevel.
*/
serial = TkpChangeFocus(TkpGetWrapperWindow(topLevelPtr), force);

View File

@@ -13,7 +13,9 @@
#include "tkInt.h"
#include "tkFont.h"
#if defined(MAC_OSX_TK)
#include "tkMacOSXInt.h"
#endif
/*
* The following structure is used to keep track of all the fonts that exist
* in the current application. It must be stored in the TkMainInfo for the
@@ -497,7 +499,7 @@ Tk_FontObjCmd(
const char *s;
Tk_Font tkfont;
Tcl_Obj *optPtr, *charPtr, *resultPtr;
Tcl_UniChar uniChar = 0;
int uniChar = 0;
const TkFontAttributes *faPtr;
TkFontAttributes fa;
@@ -562,17 +564,19 @@ Tk_FontObjCmd(
*/
if (charPtr != NULL) {
if (Tcl_GetCharLength(charPtr) != 1) {
const char *string = Tcl_GetString(charPtr);
int len = TkUtfToUniChar(string, &uniChar);
if (len != charPtr->length) {
resultPtr = Tcl_NewStringObj(
"expected a single character but got \"", -1);
Tcl_AppendLimitedToObj(resultPtr, Tcl_GetString(charPtr),
Tcl_AppendLimitedToObj(resultPtr, string,
-1, 40, "...");
Tcl_AppendToObj(resultPtr, "\"", -1);
Tcl_SetObjResult(interp, resultPtr);
Tcl_SetErrorCode(interp, "TK", "VALUE", "FONT_SAMPLE", NULL);
return TCL_ERROR;
}
uniChar = Tcl_GetUniChar(charPtr, 0);
}
/*
@@ -870,7 +874,18 @@ TheWorldHasChanged(
ClientData clientData) /* Info about application's fonts. */
{
TkFontInfo *fiPtr = clientData;
#if defined(MAC_OSX_TK)
/*
* On macOS it is catastrophic to recompute all widgets while the
* [NSView drawRect] method is drawing. The best that we can do in
* that situation is to abort the recomputation and hope for the best.
*/
if (TkpAppIsDrawing()) {
return;
}
#endif
fiPtr->updatePending = 0;
RecomputeWidgets(fiPtr->mainPtr->winPtr);
}
@@ -1226,7 +1241,7 @@ Tk_AllocFontFromObj(
descent = fontPtr->fm.descent;
fontPtr->underlinePos = descent / 2;
fontPtr->underlineHeight = TkFontGetPixels(tkwin, fontPtr->fa.size) / 10;
fontPtr->underlineHeight = (int) (TkFontGetPixels(tkwin, fontPtr->fa.size) / 10 + 0.5);
if (fontPtr->underlineHeight == 0) {
fontPtr->underlineHeight = 1;
}
@@ -1694,7 +1709,7 @@ Tk_PostscriptFontName(
} else if (strcasecmp(family, "ZapfDingbats") == 0) {
family = "ZapfDingbats";
} else {
Tcl_UniChar ch;
int ch;
/*
* Inline, capitalize the first letter of each word, lowercase the
@@ -1712,14 +1727,18 @@ Tk_PostscriptFontName(
src++;
upper = 1;
}
src += Tcl_UtfToUniChar(src, &ch);
if (upper) {
ch = Tcl_UniCharToUpper(ch);
upper = 0;
src += TkUtfToUniChar(src, &ch);
if (ch <= 0xffff) {
if (upper) {
ch = Tcl_UniCharToUpper(ch);
upper = 0;
} else {
ch = Tcl_UniCharToLower(ch);
}
} else {
ch = Tcl_UniCharToLower(ch);
upper = 0;
}
dest += Tcl_UniCharToUtf(ch, dest);
dest += TkUniCharToUtf(ch, dest);
}
*dest = '\0';
Tcl_DStringSetLength(dsPtr, dest - Tcl_DStringValue(dsPtr));
@@ -1794,7 +1813,7 @@ Tk_PostscriptFontName(
}
}
return fontPtr->fa.size;
return (int)(fontPtr->fa.size + 0.5);
}
/*
@@ -3145,14 +3164,13 @@ TkIntersectAngledTextLayout(
cy[0] = cy[1] = chunkPtr->y - fontPtr->fm.ascent;
cx[1] = cx[2] = chunkPtr->x + chunkPtr->displayWidth;
cy[2] = cy[3] = chunkPtr->y + fontPtr->fm.descent;
if ( !PointInQuadrilateral(cx, cy, rx[0], ry[0]) ||
!PointInQuadrilateral(cx, cy, rx[1], ry[1]) ||
!PointInQuadrilateral(cx, cy, rx[2], ry[2]) ||
!PointInQuadrilateral(cx, cy, rx[3], ry[3])) {
goto notReverseInside;
}
if ( PointInQuadrilateral(cx, cy, rx[0], ry[0]) &&
PointInQuadrilateral(cx, cy, rx[1], ry[1]) &&
PointInQuadrilateral(cx, cy, rx[2], ry[2]) &&
PointInQuadrilateral(cx, cy, rx[3], ry[3])) {
return 0;
}
}
return 0;
/*
* If we're overlapping now, we must be partially in and out of at least
@@ -3160,7 +3178,6 @@ TkIntersectAngledTextLayout(
* rectangle that is touching or crossing a line segment of a chunk.
*/
notReverseInside:
chunkPtr = layoutPtr->chunks;
for (i=0 ; i<layoutPtr->numChunks ; i++,chunkPtr++) {
@@ -3249,7 +3266,7 @@ Tk_TextLayoutToPostscript(
int i, j, len;
const char *p, *glyphname;
char uindex[5], c, *ps;
Tcl_UniChar ch;
int ch;
Tcl_AppendToObj(psObj, "[(", -1);
for (i = 0; i < layoutPtr->numChunks; i++, chunkPtr++) {
@@ -3272,7 +3289,7 @@ Tk_TextLayoutToPostscript(
* international postscript fonts.
*/
p += Tcl_UtfToUniChar(p, &ch);
p += TkUtfToUniChar(p, &ch);
if ((ch == '(') || (ch == ')') || (ch == '\\') || (ch < 0x20)) {
/*
* Tricky point: the "03" is necessary in the sprintf below,
@@ -3298,6 +3315,9 @@ Tk_TextLayoutToPostscript(
* use the full glyph name.
*/
if (ch > 0xffff) {
goto noMapping;
}
sprintf(uindex, "%04X", ch); /* endianness? */
glyphname = Tcl_GetVar2(interp, "::tk::psglyphs", uindex, 0);
if (glyphname) {
@@ -3318,6 +3338,7 @@ Tk_TextLayoutToPostscript(
* No known mapping for the character into the space of
* PostScript glyphs. Ignore it. :-(
*/
noMapping: ;
#ifdef TK_DEBUG_POSTSCRIPT_OUTPUT
fprintf(stderr, "Warning: no mapping to PostScript "
@@ -3399,7 +3420,7 @@ ConfigAttributesObj(
if (Tcl_GetIntFromObj(interp, valuePtr, &n) != TCL_OK) {
return TCL_ERROR;
}
faPtr->size = n;
faPtr->size = (double)n;
break;
case FONT_WEIGHT:
n = TkFindStateNumObj(interp, optionPtr, weightMap, valuePtr);
@@ -3490,7 +3511,11 @@ GetAttributeInfoObj(
break;
case FONT_SIZE:
valuePtr = Tcl_NewIntObj(faPtr->size);
if (faPtr->size >= 0.0) {
valuePtr = Tcl_NewIntObj((int)(faPtr->size + 0.5));
} else {
valuePtr = Tcl_NewIntObj(-(int)(-faPtr->size + 0.5));
}
break;
case FONT_WEIGHT:
@@ -3639,7 +3664,7 @@ ParseFontNameObj(
if (Tcl_GetIntFromObj(interp, objv[1], &n) != TCL_OK) {
return TCL_ERROR;
}
faPtr->size = n;
faPtr->size = (double)n;
}
i = 2;
@@ -3883,7 +3908,7 @@ TkFontParseXLFD(
* historical compatibility.
*/
faPtr->size = 12;
faPtr->size = 12.0;
if (FieldSpecified(field[XLFD_POINT_SIZE])) {
if (field[XLFD_POINT_SIZE][0] == '[') {
@@ -3897,10 +3922,10 @@ TkFontParseXLFD(
* the purpose of, so I ignore them.
*/
faPtr->size = atoi(field[XLFD_POINT_SIZE] + 1);
faPtr->size = atof(field[XLFD_POINT_SIZE] + 1);
} else if (Tcl_GetInt(NULL, field[XLFD_POINT_SIZE],
&faPtr->size) == TCL_OK) {
faPtr->size /= 10;
&i) == TCL_OK) {
faPtr->size = i/10.0;
} else {
return TCL_ERROR;
}
@@ -3922,9 +3947,11 @@ TkFontParseXLFD(
* ignore them.
*/
faPtr->size = atoi(field[XLFD_PIXEL_SIZE] + 1);
faPtr->size = atof(field[XLFD_PIXEL_SIZE] + 1);
} else if (Tcl_GetInt(NULL, field[XLFD_PIXEL_SIZE],
&faPtr->size) != TCL_OK) {
&i) == TCL_OK) {
faPtr->size = (double)i;
} else {
return TCL_ERROR;
}
}
@@ -4000,21 +4027,21 @@ FieldSpecified(
*---------------------------------------------------------------------------
*/
int
double
TkFontGetPixels(
Tk_Window tkwin, /* For point->pixel conversion factor. */
int size) /* Font size. */
double size) /* Font size. */
{
double d;
if (size < 0) {
if (size <= 0.0) {
return -size;
}
d = size * 25.4 / 72.0;
d *= WidthOfScreen(Tk_Screen(tkwin));
d /= WidthMMOfScreen(Tk_Screen(tkwin));
return (int) (d + 0.5);
return d;
}
/*
@@ -4034,21 +4061,21 @@ TkFontGetPixels(
*---------------------------------------------------------------------------
*/
int
double
TkFontGetPoints(
Tk_Window tkwin, /* For pixel->point conversion factor. */
int size) /* Font size. */
double size) /* Font size. */
{
double d;
if (size >= 0) {
if (size >= 0.0) {
return size;
}
d = -size * 72.0 / 25.4;
d *= WidthMMOfScreen(Tk_Screen(tkwin));
d /= WidthOfScreen(Tk_Screen(tkwin));
return (int) (d + 0.5);
return d;
}
/*

Some files were not shown because too many files have changed in this diff Show More