Pratt 1.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.exrc +61 -0
- data/.gitignore +4 -0
- data/History.txt +6 -0
- data/Manifest.txt +46 -0
- data/Pratt.gemspec +351 -0
- data/README.txt +66 -0
- data/Rakefile +85 -0
- data/TODO +54 -0
- data/VERSION +1 -0
- data/bin/pratt.rb +13 -0
- data/config.rb +34 -0
- data/lib/pratt.rb +527 -0
- data/lib/pratt/array.rb +11 -0
- data/lib/pratt/string.rb +18 -0
- data/models/app.rb +40 -0
- data/models/customer.rb +24 -0
- data/models/payment.rb +22 -0
- data/models/pratt.rb +19 -0
- data/models/project.rb +82 -0
- data/models/whence.rb +70 -0
- data/pkgs/tile-0.8.2.tar.gz +0 -0
- data/pkgs/tile-0.8.2/ANNOUNCE.txt +95 -0
- data/pkgs/tile-0.8.2/ChangeLog +4651 -0
- data/pkgs/tile-0.8.2/Makefile +250 -0
- data/pkgs/tile-0.8.2/Makefile.in +250 -0
- data/pkgs/tile-0.8.2/README.txt +86 -0
- data/pkgs/tile-0.8.2/aclocal.m4 +2 -0
- data/pkgs/tile-0.8.2/altTheme.o +0 -0
- data/pkgs/tile-0.8.2/blink.o +0 -0
- data/pkgs/tile-0.8.2/button.o +0 -0
- data/pkgs/tile-0.8.2/cache.o +0 -0
- data/pkgs/tile-0.8.2/clamTheme.o +0 -0
- data/pkgs/tile-0.8.2/classicTheme.o +0 -0
- data/pkgs/tile-0.8.2/config.log +1330 -0
- data/pkgs/tile-0.8.2/config.status +795 -0
- data/pkgs/tile-0.8.2/configure +15248 -0
- data/pkgs/tile-0.8.2/configure.in +89 -0
- data/pkgs/tile-0.8.2/demos/autocomplete.tcl +59 -0
- data/pkgs/tile-0.8.2/demos/demo.tcl +870 -0
- data/pkgs/tile-0.8.2/demos/dirbrowser.tcl +167 -0
- data/pkgs/tile-0.8.2/demos/dlgtest.tcl +97 -0
- data/pkgs/tile-0.8.2/demos/iconlib.tcl +110 -0
- data/pkgs/tile-0.8.2/demos/repeater.tcl +117 -0
- data/pkgs/tile-0.8.2/demos/toolbutton.tcl +101 -0
- data/pkgs/tile-0.8.2/doc/Geometry.3 +230 -0
- data/pkgs/tile-0.8.2/doc/INDEX.MAP +153 -0
- data/pkgs/tile-0.8.2/doc/Makefile +36 -0
- data/pkgs/tile-0.8.2/doc/TILE.XML +45 -0
- data/pkgs/tile-0.8.2/doc/Theme.3 +34 -0
- data/pkgs/tile-0.8.2/doc/button.n +75 -0
- data/pkgs/tile-0.8.2/doc/checkbutton.n +61 -0
- data/pkgs/tile-0.8.2/doc/combobox.n +98 -0
- data/pkgs/tile-0.8.2/doc/converting.txt +97 -0
- data/pkgs/tile-0.8.2/doc/dialog.n +122 -0
- data/pkgs/tile-0.8.2/doc/entry.n +438 -0
- data/pkgs/tile-0.8.2/doc/frame.n +43 -0
- data/pkgs/tile-0.8.2/doc/html/Geometry.html +304 -0
- data/pkgs/tile-0.8.2/doc/html/Theme.html +48 -0
- data/pkgs/tile-0.8.2/doc/html/button.html +120 -0
- data/pkgs/tile-0.8.2/doc/html/category-index.html +18 -0
- data/pkgs/tile-0.8.2/doc/html/checkbutton.html +94 -0
- data/pkgs/tile-0.8.2/doc/html/combobox.html +164 -0
- data/pkgs/tile-0.8.2/doc/html/converting.txt +97 -0
- data/pkgs/tile-0.8.2/doc/html/dialog.html +159 -0
- data/pkgs/tile-0.8.2/doc/html/entry.html +613 -0
- data/pkgs/tile-0.8.2/doc/html/frame.html +76 -0
- data/pkgs/tile-0.8.2/doc/html/image.html +100 -0
- data/pkgs/tile-0.8.2/doc/html/index.html +25 -0
- data/pkgs/tile-0.8.2/doc/html/keyword-index.html +228 -0
- data/pkgs/tile-0.8.2/doc/html/label.html +133 -0
- data/pkgs/tile-0.8.2/doc/html/labelframe.html +91 -0
- data/pkgs/tile-0.8.2/doc/html/manpage.css +212 -0
- data/pkgs/tile-0.8.2/doc/html/menubutton.html +63 -0
- data/pkgs/tile-0.8.2/doc/html/notebook.html +280 -0
- data/pkgs/tile-0.8.2/doc/html/paned.html +149 -0
- data/pkgs/tile-0.8.2/doc/html/progressbar.html +138 -0
- data/pkgs/tile-0.8.2/doc/html/radiobutton.html +89 -0
- data/pkgs/tile-0.8.2/doc/html/scrollbar.html +221 -0
- data/pkgs/tile-0.8.2/doc/html/separator.html +48 -0
- data/pkgs/tile-0.8.2/doc/html/sizegrip.html +62 -0
- data/pkgs/tile-0.8.2/doc/html/style.html +172 -0
- data/pkgs/tile-0.8.2/doc/html/tile-intro.html +164 -0
- data/pkgs/tile-0.8.2/doc/html/treeview.html +634 -0
- data/pkgs/tile-0.8.2/doc/html/widget.html +342 -0
- data/pkgs/tile-0.8.2/doc/image.n +81 -0
- data/pkgs/tile-0.8.2/doc/internals.txt +409 -0
- data/pkgs/tile-0.8.2/doc/label.n +75 -0
- data/pkgs/tile-0.8.2/doc/labelframe.n +64 -0
- data/pkgs/tile-0.8.2/doc/man.macros +239 -0
- data/pkgs/tile-0.8.2/doc/menubutton.n +41 -0
- data/pkgs/tile-0.8.2/doc/notebook.n +188 -0
- data/pkgs/tile-0.8.2/doc/paned.n +95 -0
- data/pkgs/tile-0.8.2/doc/progressbar.n +79 -0
- data/pkgs/tile-0.8.2/doc/radiobutton.n +57 -0
- data/pkgs/tile-0.8.2/doc/scrollbar.n +160 -0
- data/pkgs/tile-0.8.2/doc/separator.n +30 -0
- data/pkgs/tile-0.8.2/doc/sizegrip.n +53 -0
- data/pkgs/tile-0.8.2/doc/style.n +119 -0
- data/pkgs/tile-0.8.2/doc/tile-intro.n +165 -0
- data/pkgs/tile-0.8.2/doc/tmml.options +4 -0
- data/pkgs/tile-0.8.2/doc/treeview.n +415 -0
- data/pkgs/tile-0.8.2/doc/widget.n +227 -0
- data/pkgs/tile-0.8.2/doc/xml/Geometry.tmml +379 -0
- data/pkgs/tile-0.8.2/doc/xml/INDEX.MAP +153 -0
- data/pkgs/tile-0.8.2/doc/xml/Theme.tmml +63 -0
- data/pkgs/tile-0.8.2/doc/xml/button.tmml +134 -0
- data/pkgs/tile-0.8.2/doc/xml/checkbutton.tmml +119 -0
- data/pkgs/tile-0.8.2/doc/xml/combobox.tmml +184 -0
- data/pkgs/tile-0.8.2/doc/xml/dialog.tmml +195 -0
- data/pkgs/tile-0.8.2/doc/xml/entry.tmml +630 -0
- data/pkgs/tile-0.8.2/doc/xml/frame.tmml +98 -0
- data/pkgs/tile-0.8.2/doc/xml/image.tmml +101 -0
- data/pkgs/tile-0.8.2/doc/xml/label.tmml +154 -0
- data/pkgs/tile-0.8.2/doc/xml/labelframe.tmml +116 -0
- data/pkgs/tile-0.8.2/doc/xml/menubutton.tmml +80 -0
- data/pkgs/tile-0.8.2/doc/xml/notebook.tmml +306 -0
- data/pkgs/tile-0.8.2/doc/xml/paned.tmml +154 -0
- data/pkgs/tile-0.8.2/doc/xml/progressbar.tmml +151 -0
- data/pkgs/tile-0.8.2/doc/xml/radiobutton.tmml +109 -0
- data/pkgs/tile-0.8.2/doc/xml/scrollbar.tmml +233 -0
- data/pkgs/tile-0.8.2/doc/xml/separator.tmml +59 -0
- data/pkgs/tile-0.8.2/doc/xml/sizegrip.tmml +82 -0
- data/pkgs/tile-0.8.2/doc/xml/style.tmml +171 -0
- data/pkgs/tile-0.8.2/doc/xml/tile-intro.tmml +192 -0
- data/pkgs/tile-0.8.2/doc/xml/treeview.tmml +604 -0
- data/pkgs/tile-0.8.2/doc/xml/widget.tmml +372 -0
- data/pkgs/tile-0.8.2/entry.o +0 -0
- data/pkgs/tile-0.8.2/frame.o +0 -0
- data/pkgs/tile-0.8.2/generic/Makefile.in +221 -0
- data/pkgs/tile-0.8.2/generic/TODO +493 -0
- data/pkgs/tile-0.8.2/generic/altTheme.c +1172 -0
- data/pkgs/tile-0.8.2/generic/blink.c +168 -0
- data/pkgs/tile-0.8.2/generic/button.c +858 -0
- data/pkgs/tile-0.8.2/generic/cache.c +354 -0
- data/pkgs/tile-0.8.2/generic/clamTheme.c +974 -0
- data/pkgs/tile-0.8.2/generic/classicTheme.c +518 -0
- data/pkgs/tile-0.8.2/generic/configure +10334 -0
- data/pkgs/tile-0.8.2/generic/configure.in +100 -0
- data/pkgs/tile-0.8.2/generic/entry.c +1922 -0
- data/pkgs/tile-0.8.2/generic/frame.c +648 -0
- data/pkgs/tile-0.8.2/generic/gunk.h +44 -0
- data/pkgs/tile-0.8.2/generic/image.c +416 -0
- data/pkgs/tile-0.8.2/generic/label.c +663 -0
- data/pkgs/tile-0.8.2/generic/layout.c +1215 -0
- data/pkgs/tile-0.8.2/generic/manager.c +554 -0
- data/pkgs/tile-0.8.2/generic/manager.h +91 -0
- data/pkgs/tile-0.8.2/generic/notebook.c +1380 -0
- data/pkgs/tile-0.8.2/generic/paned.c +958 -0
- data/pkgs/tile-0.8.2/generic/pkgIndex.tcl.in +7 -0
- data/pkgs/tile-0.8.2/generic/progress.c +549 -0
- data/pkgs/tile-0.8.2/generic/scale.c +526 -0
- data/pkgs/tile-0.8.2/generic/scroll.c +253 -0
- data/pkgs/tile-0.8.2/generic/scrollbar.c +346 -0
- data/pkgs/tile-0.8.2/generic/separator.c +132 -0
- data/pkgs/tile-0.8.2/generic/square.c +306 -0
- data/pkgs/tile-0.8.2/generic/tagset.c +147 -0
- data/pkgs/tile-0.8.2/generic/tile.c +296 -0
- data/pkgs/tile-0.8.2/generic/tkElements.c +1280 -0
- data/pkgs/tile-0.8.2/generic/tkTheme.c +1708 -0
- data/pkgs/tile-0.8.2/generic/tkTheme.h +419 -0
- data/pkgs/tile-0.8.2/generic/tkThemeInt.h +45 -0
- data/pkgs/tile-0.8.2/generic/tkstate.c +268 -0
- data/pkgs/tile-0.8.2/generic/trace.c +145 -0
- data/pkgs/tile-0.8.2/generic/track.c +174 -0
- data/pkgs/tile-0.8.2/generic/treeview.c +3211 -0
- data/pkgs/tile-0.8.2/generic/ttk.decls +154 -0
- data/pkgs/tile-0.8.2/generic/ttkDecls.h +340 -0
- data/pkgs/tile-0.8.2/generic/ttkStubInit.c +61 -0
- data/pkgs/tile-0.8.2/generic/ttkStubLib.c +70 -0
- data/pkgs/tile-0.8.2/generic/widget.c +785 -0
- data/pkgs/tile-0.8.2/generic/widget.h +263 -0
- data/pkgs/tile-0.8.2/image.o +0 -0
- data/pkgs/tile-0.8.2/label.o +0 -0
- data/pkgs/tile-0.8.2/layout.o +0 -0
- data/pkgs/tile-0.8.2/library/altTheme.tcl +101 -0
- data/pkgs/tile-0.8.2/library/aquaTheme.tcl +62 -0
- data/pkgs/tile-0.8.2/library/button.tcl +85 -0
- data/pkgs/tile-0.8.2/library/clamTheme.tcl +139 -0
- data/pkgs/tile-0.8.2/library/classicTheme.tcl +108 -0
- data/pkgs/tile-0.8.2/library/combobox.tcl +439 -0
- data/pkgs/tile-0.8.2/library/cursors.tcl +36 -0
- data/pkgs/tile-0.8.2/library/defaults.tcl +118 -0
- data/pkgs/tile-0.8.2/library/dialog.tcl +274 -0
- data/pkgs/tile-0.8.2/library/entry.tcl +580 -0
- data/pkgs/tile-0.8.2/library/fonts.tcl +153 -0
- data/pkgs/tile-0.8.2/library/icons.tcl +105 -0
- data/pkgs/tile-0.8.2/library/keynav.tcl +192 -0
- data/pkgs/tile-0.8.2/library/menubutton.tcl +171 -0
- data/pkgs/tile-0.8.2/library/notebook.tcl +193 -0
- data/pkgs/tile-0.8.2/library/paned.tcl +87 -0
- data/pkgs/tile-0.8.2/library/progress.tcl +51 -0
- data/pkgs/tile-0.8.2/library/scale.tcl +54 -0
- data/pkgs/tile-0.8.2/library/scrollbar.tcl +125 -0
- data/pkgs/tile-0.8.2/library/sizegrip.tcl +77 -0
- data/pkgs/tile-0.8.2/library/tile.tcl +211 -0
- data/pkgs/tile-0.8.2/library/treeview.tcl +382 -0
- data/pkgs/tile-0.8.2/library/utils.tcl +254 -0
- data/pkgs/tile-0.8.2/library/winTheme.tcl +77 -0
- data/pkgs/tile-0.8.2/library/xpTheme.tcl +63 -0
- data/pkgs/tile-0.8.2/libtile0.8.2.so +0 -0
- data/pkgs/tile-0.8.2/libttkstub.a +0 -0
- data/pkgs/tile-0.8.2/license.terms +24 -0
- data/pkgs/tile-0.8.2/macosx/aquaTheme.c +1076 -0
- data/pkgs/tile-0.8.2/manager.o +0 -0
- data/pkgs/tile-0.8.2/notebook.o +0 -0
- data/pkgs/tile-0.8.2/paned.o +0 -0
- data/pkgs/tile-0.8.2/pkgIndex.tcl +3 -0
- data/pkgs/tile-0.8.2/progress.o +0 -0
- data/pkgs/tile-0.8.2/scale.o +0 -0
- data/pkgs/tile-0.8.2/scroll.o +0 -0
- data/pkgs/tile-0.8.2/scrollbar.o +0 -0
- data/pkgs/tile-0.8.2/separator.o +0 -0
- data/pkgs/tile-0.8.2/tagset.o +0 -0
- data/pkgs/tile-0.8.2/tclconfig/install-sh +119 -0
- data/pkgs/tile-0.8.2/tclconfig/tcl.m4 +4069 -0
- data/pkgs/tile-0.8.2/tclconfig/teax.m4 +109 -0
- data/pkgs/tile-0.8.2/tests/all.tcl +18 -0
- data/pkgs/tile-0.8.2/tests/bwidget.test +103 -0
- data/pkgs/tile-0.8.2/tests/cbtest.tcl +125 -0
- data/pkgs/tile-0.8.2/tests/combobox.test +51 -0
- data/pkgs/tile-0.8.2/tests/compound.tcl +92 -0
- data/pkgs/tile-0.8.2/tests/entry.test +285 -0
- data/pkgs/tile-0.8.2/tests/entrytest.tcl +78 -0
- data/pkgs/tile-0.8.2/tests/image.test +94 -0
- data/pkgs/tile-0.8.2/tests/labelframe.tcl +41 -0
- data/pkgs/tile-0.8.2/tests/labelframe.test +137 -0
- data/pkgs/tile-0.8.2/tests/layout.test +33 -0
- data/pkgs/tile-0.8.2/tests/misc.test +35 -0
- data/pkgs/tile-0.8.2/tests/nbtest.tcl +66 -0
- data/pkgs/tile-0.8.2/tests/notebook.test +500 -0
- data/pkgs/tile-0.8.2/tests/paned.test +298 -0
- data/pkgs/tile-0.8.2/tests/progress.test +92 -0
- data/pkgs/tile-0.8.2/tests/pwtest.tcl +90 -0
- data/pkgs/tile-0.8.2/tests/sbtest.tcl +79 -0
- data/pkgs/tile-0.8.2/tests/scrollbar.test +77 -0
- data/pkgs/tile-0.8.2/tests/sgtest.tcl +52 -0
- data/pkgs/tile-0.8.2/tests/testutils.tcl +20 -0
- data/pkgs/tile-0.8.2/tests/tile.test +674 -0
- data/pkgs/tile-0.8.2/tests/treetags.test +78 -0
- data/pkgs/tile-0.8.2/tests/treeview.test +563 -0
- data/pkgs/tile-0.8.2/tests/tvtest.tcl +332 -0
- data/pkgs/tile-0.8.2/tests/validate.test +278 -0
- data/pkgs/tile-0.8.2/tile.o +0 -0
- data/pkgs/tile-0.8.2/tkElements.o +0 -0
- data/pkgs/tile-0.8.2/tkTheme.o +0 -0
- data/pkgs/tile-0.8.2/tkstate.o +0 -0
- data/pkgs/tile-0.8.2/tools/genStubs.tcl +861 -0
- data/pkgs/tile-0.8.2/trace.o +0 -0
- data/pkgs/tile-0.8.2/track.o +0 -0
- data/pkgs/tile-0.8.2/treeview.o +0 -0
- data/pkgs/tile-0.8.2/ttkStubInit.o +0 -0
- data/pkgs/tile-0.8.2/ttkStubLib.o +0 -0
- data/pkgs/tile-0.8.2/widget.o +0 -0
- data/pkgs/tile-0.8.2/win/Tile.dsp +261 -0
- data/pkgs/tile-0.8.2/win/makefile.vc +527 -0
- data/pkgs/tile-0.8.2/win/monitor.c +164 -0
- data/pkgs/tile-0.8.2/win/nmakehlp.c +483 -0
- data/pkgs/tile-0.8.2/win/rules.vc +512 -0
- data/pkgs/tile-0.8.2/win/tile.rc +40 -0
- data/pkgs/tile-0.8.2/win/winTheme.c +734 -0
- data/pkgs/tile-0.8.2/win/xpTheme.c +1029 -0
- data/spec/app_spec.rb +48 -0
- data/spec/customer_spec.rb +31 -0
- data/spec/fixtures/graph.expectation +18 -0
- data/spec/payment_spec.rb +19 -0
- data/spec/pratt_spec.rb +148 -0
- data/spec/project_spec.rb +163 -0
- data/spec/rcov.opts +0 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/whence_spec.rb +54 -0
- data/tasks/pratt.rb +84 -0
- data/templates/model.eruby +12 -0
- data/templates/spec.eruby +8 -0
- data/views/env.rb +22 -0
- data/views/graph.eruby +20 -0
- data/views/invoice.eruby +148 -0
- data/views/main.rb +92 -0
- data/views/pid.eruby +3 -0
- data/views/pop.rb +94 -0
- data/views/pop2.rb +75 -0
- data/views/raw.eruby +11 -0
- metadata +390 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/* widget.h,v 1.57 2007/12/02 03:06:51 jenglish Exp
|
|
2
|
+
* Copyright (c) 2003, Joe English
|
|
3
|
+
* Helper routines for widget implementations.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
#ifndef _TTKWIDGET
|
|
7
|
+
#define _TTKWIDGET
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* State flags for 'flags' field.
|
|
11
|
+
*/
|
|
12
|
+
#define WIDGET_DESTROYED 0x0001
|
|
13
|
+
#define REDISPLAY_PENDING 0x0002 /* scheduled call to RedisplayWidget */
|
|
14
|
+
#define WIDGET_REALIZED 0x0010 /* set at first ConfigureNotify */
|
|
15
|
+
#define CURSOR_ON 0x0020 /* See TtkBlinkCursor() */
|
|
16
|
+
#define WIDGET_USER_FLAG 0x0100 /* 0x0100 - 0x8000 for user flags */
|
|
17
|
+
|
|
18
|
+
/*
|
|
19
|
+
* Bit fields for OptionSpec 'mask' field:
|
|
20
|
+
*/
|
|
21
|
+
#define READONLY_OPTION 0x1
|
|
22
|
+
#define STYLE_CHANGED 0x2
|
|
23
|
+
#define GEOMETRY_CHANGED 0x4
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
* Core widget elements
|
|
27
|
+
*/
|
|
28
|
+
typedef struct WidgetSpec_ WidgetSpec; /* Forward */
|
|
29
|
+
|
|
30
|
+
typedef struct
|
|
31
|
+
{
|
|
32
|
+
Tk_Window tkwin; /* Window associated with widget */
|
|
33
|
+
Tcl_Interp *interp; /* Interpreter associated with widget. */
|
|
34
|
+
WidgetSpec *widgetSpec; /* Widget class hooks */
|
|
35
|
+
Tcl_Command widgetCmd; /* Token for widget command. */
|
|
36
|
+
Tk_OptionTable optionTable; /* Option table */
|
|
37
|
+
Ttk_Layout layout; /* Widget layout */
|
|
38
|
+
|
|
39
|
+
/*
|
|
40
|
+
* Storage for resources:
|
|
41
|
+
*/
|
|
42
|
+
Tcl_Obj *takeFocusPtr; /* Storage for -takefocus option */
|
|
43
|
+
Tcl_Obj *cursorObj; /* Storage for -cursor option */
|
|
44
|
+
Tcl_Obj *styleObj; /* Name of currently-applied style */
|
|
45
|
+
Tcl_Obj *classObj; /* Class name (readonly option) */
|
|
46
|
+
|
|
47
|
+
Ttk_State state; /* Current widget state */
|
|
48
|
+
unsigned int flags; /* internal flags, see above */
|
|
49
|
+
|
|
50
|
+
} WidgetCore;
|
|
51
|
+
|
|
52
|
+
/*
|
|
53
|
+
* Subcommand specifications:
|
|
54
|
+
*/
|
|
55
|
+
typedef int (*WidgetSubcommandProc)(
|
|
56
|
+
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr);
|
|
57
|
+
typedef struct {
|
|
58
|
+
const char *name;
|
|
59
|
+
WidgetSubcommandProc command;
|
|
60
|
+
} WidgetCommandSpec;
|
|
61
|
+
|
|
62
|
+
MODULE_SCOPE int TtkWidgetEnsembleCommand( /* Run an ensemble command */
|
|
63
|
+
const WidgetCommandSpec *commands, int cmdIndex,
|
|
64
|
+
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr);
|
|
65
|
+
|
|
66
|
+
/*
|
|
67
|
+
* Widget specifications:
|
|
68
|
+
*/
|
|
69
|
+
struct WidgetSpec_
|
|
70
|
+
{
|
|
71
|
+
const char *className; /* Widget class name */
|
|
72
|
+
size_t recordSize; /* #bytes in widget record */
|
|
73
|
+
const Tk_OptionSpec *optionSpecs; /* Option specifications */
|
|
74
|
+
const WidgetCommandSpec *commands; /* Widget instance subcommands */
|
|
75
|
+
|
|
76
|
+
/*
|
|
77
|
+
* Hooks:
|
|
78
|
+
*/
|
|
79
|
+
int (*initializeProc)(Tcl_Interp *, void *recordPtr);
|
|
80
|
+
void (*cleanupProc)(void *recordPtr);
|
|
81
|
+
int (*configureProc)(Tcl_Interp *, void *recordPtr, int flags);
|
|
82
|
+
int (*postConfigureProc)(Tcl_Interp *, void *recordPtr, int flags);
|
|
83
|
+
Ttk_Layout (*getLayoutProc)(Tcl_Interp *,Ttk_Theme, void *recordPtr);
|
|
84
|
+
int (*sizeProc)(void *recordPtr, int *widthPtr, int *heightPtr);
|
|
85
|
+
void (*layoutProc)(void *recordPtr);
|
|
86
|
+
void (*displayProc)(void *recordPtr, Drawable d);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/*
|
|
90
|
+
* Common factors for widget implementations:
|
|
91
|
+
*/
|
|
92
|
+
MODULE_SCOPE int TtkNullInitialize(Tcl_Interp *, void *);
|
|
93
|
+
MODULE_SCOPE int TtkNullPostConfigure(Tcl_Interp *, void *, int);
|
|
94
|
+
MODULE_SCOPE void TtkNullCleanup(void *recordPtr);
|
|
95
|
+
MODULE_SCOPE Ttk_Layout TtkWidgetGetLayout(
|
|
96
|
+
Tcl_Interp *, Ttk_Theme, void *recordPtr);
|
|
97
|
+
MODULE_SCOPE Ttk_Layout TtkWidgetGetOrientedLayout(
|
|
98
|
+
Tcl_Interp *, Ttk_Theme, void *recordPtr, Tcl_Obj *orientObj);
|
|
99
|
+
MODULE_SCOPE int TtkWidgetSize(void *recordPtr, int *w, int *h);
|
|
100
|
+
MODULE_SCOPE void TtkWidgetDoLayout(void *recordPtr);
|
|
101
|
+
MODULE_SCOPE void TtkWidgetDisplay(void *recordPtr, Drawable);
|
|
102
|
+
|
|
103
|
+
MODULE_SCOPE int TtkCoreConfigure(Tcl_Interp*, void *, int mask);
|
|
104
|
+
|
|
105
|
+
/* Common widget commands:
|
|
106
|
+
*/
|
|
107
|
+
MODULE_SCOPE int TtkWidgetConfigureCommand(
|
|
108
|
+
Tcl_Interp *, int, Tcl_Obj*const[], void *);
|
|
109
|
+
MODULE_SCOPE int TtkWidgetCgetCommand(
|
|
110
|
+
Tcl_Interp *, int, Tcl_Obj*const[], void *);
|
|
111
|
+
MODULE_SCOPE int TtkWidgetInstateCommand(
|
|
112
|
+
Tcl_Interp *, int, Tcl_Obj*const[], void *);
|
|
113
|
+
MODULE_SCOPE int TtkWidgetStateCommand(
|
|
114
|
+
Tcl_Interp *, int, Tcl_Obj*const[], void *);
|
|
115
|
+
MODULE_SCOPE int TtkWidgetIdentifyCommand(
|
|
116
|
+
Tcl_Interp *, int, Tcl_Obj*const[], void *);
|
|
117
|
+
|
|
118
|
+
/* Widget constructor:
|
|
119
|
+
*/
|
|
120
|
+
MODULE_SCOPE int TtkWidgetConstructorObjCmd(
|
|
121
|
+
ClientData, Tcl_Interp*, int, Tcl_Obj*const[]);
|
|
122
|
+
|
|
123
|
+
#define RegisterWidget(interp, name, specPtr) \
|
|
124
|
+
Tcl_CreateObjCommand(interp, name, \
|
|
125
|
+
TtkWidgetConstructorObjCmd, (ClientData)specPtr,NULL)
|
|
126
|
+
|
|
127
|
+
/* WIDGET_TAKES_FOCUS --
|
|
128
|
+
* Add this to the OptionSpecs table of widgets that
|
|
129
|
+
* take keyboard focus during traversal to override
|
|
130
|
+
* CoreOptionSpec's -takefocus default value:
|
|
131
|
+
*/
|
|
132
|
+
#define WIDGET_TAKES_FOCUS \
|
|
133
|
+
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", \
|
|
134
|
+
"ttk::takefocus", Tk_Offset(WidgetCore, takeFocusPtr), -1, 0,0,0 }
|
|
135
|
+
|
|
136
|
+
/* WIDGET_INHERIT_OPTIONS(baseOptionSpecs) --
|
|
137
|
+
* Add this at the end of an OptionSpecs table to inherit
|
|
138
|
+
* the options from 'baseOptionSpecs'.
|
|
139
|
+
*/
|
|
140
|
+
#define WIDGET_INHERIT_OPTIONS(baseOptionSpecs) \
|
|
141
|
+
{TK_OPTION_END, 0,0,0, NULL, -1,-1, 0, (ClientData)baseOptionSpecs, 0}
|
|
142
|
+
|
|
143
|
+
/*
|
|
144
|
+
* Useful routines for use inside widget implementations:
|
|
145
|
+
*/
|
|
146
|
+
/* extern int WidgetDestroyed(WidgetCore *); */
|
|
147
|
+
#define WidgetDestroyed(corePtr) ((corePtr)->flags & WIDGET_DESTROYED)
|
|
148
|
+
|
|
149
|
+
MODULE_SCOPE void TtkWidgetChangeState(WidgetCore *,
|
|
150
|
+
unsigned int setBits, unsigned int clearBits);
|
|
151
|
+
|
|
152
|
+
MODULE_SCOPE void TtkRedisplayWidget(WidgetCore *);
|
|
153
|
+
MODULE_SCOPE void TtkResizeWidget(WidgetCore *);
|
|
154
|
+
|
|
155
|
+
MODULE_SCOPE void TtkTrackElementState(WidgetCore *);
|
|
156
|
+
MODULE_SCOPE void TtkBlinkCursor(WidgetCore *);
|
|
157
|
+
|
|
158
|
+
/*
|
|
159
|
+
* -state option values (compatibility)
|
|
160
|
+
*/
|
|
161
|
+
MODULE_SCOPE void TtkCheckStateOption(WidgetCore *, Tcl_Obj *);
|
|
162
|
+
|
|
163
|
+
/*
|
|
164
|
+
* Variable traces:
|
|
165
|
+
*/
|
|
166
|
+
typedef void (*Ttk_TraceProc)(void *recordPtr, const char *value);
|
|
167
|
+
typedef struct TtkTraceHandle_ Ttk_TraceHandle;
|
|
168
|
+
|
|
169
|
+
MODULE_SCOPE Ttk_TraceHandle *Ttk_TraceVariable(
|
|
170
|
+
Tcl_Interp*, Tcl_Obj *varnameObj, Ttk_TraceProc callback, void *clientData);
|
|
171
|
+
MODULE_SCOPE void Ttk_UntraceVariable(Ttk_TraceHandle *);
|
|
172
|
+
MODULE_SCOPE int Ttk_FireTrace(Ttk_TraceHandle *);
|
|
173
|
+
|
|
174
|
+
/*
|
|
175
|
+
* Virtual events:
|
|
176
|
+
*/
|
|
177
|
+
MODULE_SCOPE void TtkSendVirtualEvent(Tk_Window tgtWin, const char *eventName);
|
|
178
|
+
|
|
179
|
+
/*
|
|
180
|
+
* Helper routines for data accessor commands:
|
|
181
|
+
*/
|
|
182
|
+
MODULE_SCOPE int TtkEnumerateOptions(
|
|
183
|
+
Tcl_Interp *, void *, const Tk_OptionSpec *, Tk_OptionTable, Tk_Window);
|
|
184
|
+
MODULE_SCOPE int TtkGetOptionValue(
|
|
185
|
+
Tcl_Interp *, void *, Tcl_Obj *optName, Tk_OptionTable, Tk_Window);
|
|
186
|
+
|
|
187
|
+
/*
|
|
188
|
+
* Helper routines for scrolling widgets (see scroll.c).
|
|
189
|
+
*/
|
|
190
|
+
typedef struct {
|
|
191
|
+
int first; /* First visible item */
|
|
192
|
+
int last; /* Last visible item */
|
|
193
|
+
int total; /* Total #items */
|
|
194
|
+
char *scrollCmd; /* Widget option */
|
|
195
|
+
} Scrollable;
|
|
196
|
+
|
|
197
|
+
typedef struct ScrollHandleRec *ScrollHandle;
|
|
198
|
+
|
|
199
|
+
MODULE_SCOPE ScrollHandle TtkCreateScrollHandle(WidgetCore *, Scrollable *);
|
|
200
|
+
MODULE_SCOPE void TtkFreeScrollHandle(ScrollHandle);
|
|
201
|
+
|
|
202
|
+
MODULE_SCOPE int TtkScrollviewCommand(
|
|
203
|
+
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], ScrollHandle);
|
|
204
|
+
|
|
205
|
+
MODULE_SCOPE void TtkScrollTo(ScrollHandle, int newFirst);
|
|
206
|
+
MODULE_SCOPE void TtkScrolled(ScrollHandle, int first, int last, int total);
|
|
207
|
+
MODULE_SCOPE void TtkScrollbarUpdateRequired(ScrollHandle);
|
|
208
|
+
|
|
209
|
+
/*
|
|
210
|
+
* Tag sets (work in progress, half-baked)
|
|
211
|
+
*/
|
|
212
|
+
|
|
213
|
+
typedef struct TtkTag *Ttk_Tag;
|
|
214
|
+
typedef struct TtkTagTable *Ttk_TagTable;
|
|
215
|
+
|
|
216
|
+
MODULE_SCOPE Ttk_TagTable Ttk_CreateTagTable(Tk_OptionTable, int tagRecSize);
|
|
217
|
+
MODULE_SCOPE void Ttk_DeleteTagTable(Ttk_TagTable);
|
|
218
|
+
|
|
219
|
+
MODULE_SCOPE Ttk_Tag Ttk_GetTag(Ttk_TagTable, const char *tagName);
|
|
220
|
+
MODULE_SCOPE Ttk_Tag Ttk_GetTagFromObj(Ttk_TagTable, Tcl_Obj *);
|
|
221
|
+
|
|
222
|
+
MODULE_SCOPE Tcl_Obj **Ttk_TagRecord(Ttk_Tag);
|
|
223
|
+
|
|
224
|
+
MODULE_SCOPE int Ttk_GetTagListFromObj(
|
|
225
|
+
Tcl_Interp *interp, Ttk_TagTable, Tcl_Obj *objPtr,
|
|
226
|
+
int *nTags_rtn, void **taglist_rtn);
|
|
227
|
+
|
|
228
|
+
MODULE_SCOPE void Ttk_FreeTagList(void **taglist);
|
|
229
|
+
|
|
230
|
+
/*
|
|
231
|
+
* Useful widget base classes:
|
|
232
|
+
*/
|
|
233
|
+
MODULE_SCOPE Tk_OptionSpec ttkCoreOptionSpecs[];
|
|
234
|
+
|
|
235
|
+
/*
|
|
236
|
+
* String tables for widget resource specifications:
|
|
237
|
+
*/
|
|
238
|
+
|
|
239
|
+
MODULE_SCOPE const char *ttkOrientStrings[];
|
|
240
|
+
MODULE_SCOPE const char *ttkCompoundStrings[];
|
|
241
|
+
MODULE_SCOPE const char *ttkDefaultStrings[];
|
|
242
|
+
|
|
243
|
+
/*
|
|
244
|
+
* ... other option types...
|
|
245
|
+
*/
|
|
246
|
+
MODULE_SCOPE int TtkGetLabelAnchorFromObj(
|
|
247
|
+
Tcl_Interp*, Tcl_Obj*, Ttk_PositionSpec *);
|
|
248
|
+
|
|
249
|
+
/*
|
|
250
|
+
* Platform-specific initialization.
|
|
251
|
+
*/
|
|
252
|
+
|
|
253
|
+
#if defined(__WIN32__)
|
|
254
|
+
#define Ttk_PlatformInit Ttk_WinPlatformInit
|
|
255
|
+
MODULE_SCOPE int Ttk_PlatformInit(Tcl_Interp *);
|
|
256
|
+
#elif defined(MAC_OSX_TK)
|
|
257
|
+
#define Ttk_PlatformInit Ttk_MacOSXPlatformInit
|
|
258
|
+
MODULE_SCOPE int Ttk_PlatformInit(Tcl_Interp *);
|
|
259
|
+
#else
|
|
260
|
+
#define Ttk_PlatformInit(interp) /* TTK_X11PlatformInit() */
|
|
261
|
+
#endif
|
|
262
|
+
|
|
263
|
+
#endif /* _TTKWIDGET */
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#
|
|
2
|
+
# altTheme.tcl,v 1.40 2007/12/08 03:52:01 jenglish Exp
|
|
3
|
+
#
|
|
4
|
+
# Tile widget set: Alternate theme
|
|
5
|
+
#
|
|
6
|
+
|
|
7
|
+
namespace eval ttk::theme::alt {
|
|
8
|
+
|
|
9
|
+
variable colors
|
|
10
|
+
array set colors {
|
|
11
|
+
-frame "#d9d9d9"
|
|
12
|
+
-window "#ffffff"
|
|
13
|
+
-darker "#c3c3c3"
|
|
14
|
+
-activebg "#ececec"
|
|
15
|
+
-disabledfg "#a3a3a3"
|
|
16
|
+
-selectbg "#4a6984"
|
|
17
|
+
-selectfg "#ffffff"
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
ttk::style theme settings alt {
|
|
21
|
+
|
|
22
|
+
ttk::style configure "." \
|
|
23
|
+
-background $colors(-frame) \
|
|
24
|
+
-foreground black \
|
|
25
|
+
-troughcolor $colors(-darker) \
|
|
26
|
+
-selectbackground $colors(-selectbg) \
|
|
27
|
+
-selectforeground $colors(-selectfg) \
|
|
28
|
+
-font TkDefaultFont \
|
|
29
|
+
;
|
|
30
|
+
|
|
31
|
+
ttk::style map "." -background \
|
|
32
|
+
[list disabled $colors(-frame) active $colors(-activebg)] ;
|
|
33
|
+
ttk::style map "." -foreground [list disabled $colors(-disabledfg)] ;
|
|
34
|
+
ttk::style map "." -embossed [list disabled 1] ;
|
|
35
|
+
|
|
36
|
+
ttk::style configure TButton \
|
|
37
|
+
-anchor center -width -11 -padding "1 1" \
|
|
38
|
+
-relief raised -shiftrelief 1 \
|
|
39
|
+
-highlightthickness 1 -highlightcolor $colors(-frame)
|
|
40
|
+
|
|
41
|
+
ttk::style map TButton -relief {
|
|
42
|
+
{pressed !disabled} sunken
|
|
43
|
+
{active !disabled} raised
|
|
44
|
+
} -highlightcolor {alternate black}
|
|
45
|
+
|
|
46
|
+
ttk::style configure TCheckbutton -indicatorcolor "#ffffff" -padding 2
|
|
47
|
+
ttk::style configure TRadiobutton -indicatorcolor "#ffffff" -padding 2
|
|
48
|
+
ttk::style map TCheckbutton -indicatorcolor \
|
|
49
|
+
[list disabled $colors(-frame) pressed $colors(-frame)]
|
|
50
|
+
ttk::style map TRadiobutton -indicatorcolor \
|
|
51
|
+
[list disabled $colors(-frame) pressed $colors(-frame)]
|
|
52
|
+
|
|
53
|
+
ttk::style configure TMenubutton \
|
|
54
|
+
-width -11 -padding "3 3" -relief raised
|
|
55
|
+
|
|
56
|
+
ttk::style configure TEntry -padding 1
|
|
57
|
+
ttk::style map TEntry -fieldbackground \
|
|
58
|
+
[list readonly $colors(-frame) disabled $colors(-frame)]
|
|
59
|
+
ttk::style configure TCombobox -padding 1
|
|
60
|
+
ttk::style map TCombobox -fieldbackground \
|
|
61
|
+
[list readonly $colors(-frame) disabled $colors(-frame)]
|
|
62
|
+
|
|
63
|
+
ttk::style configure Toolbutton -relief flat -padding 2
|
|
64
|
+
ttk::style map Toolbutton -relief \
|
|
65
|
+
{disabled flat selected sunken pressed sunken active raised}
|
|
66
|
+
ttk::style map Toolbutton -background \
|
|
67
|
+
[list pressed $colors(-darker) active $colors(-activebg)]
|
|
68
|
+
|
|
69
|
+
ttk::style configure TScrollbar -relief raised
|
|
70
|
+
|
|
71
|
+
ttk::style configure TLabelframe -relief groove -borderwidth 2
|
|
72
|
+
|
|
73
|
+
ttk::style configure TNotebook -tabmargins {2 2 1 0}
|
|
74
|
+
ttk::style configure TNotebook.Tab \
|
|
75
|
+
-padding {4 2} -background $colors(-darker)
|
|
76
|
+
ttk::style map TNotebook.Tab \
|
|
77
|
+
-background [list selected $colors(-frame)] \
|
|
78
|
+
-expand [list selected {2 2 1 0}] \
|
|
79
|
+
;
|
|
80
|
+
|
|
81
|
+
# Treeview:
|
|
82
|
+
ttk::style configure Heading -font TkHeadingFont -relief raised
|
|
83
|
+
ttk::style configure Row -background $colors(-window)
|
|
84
|
+
ttk::style configure Cell -background $colors(-window)
|
|
85
|
+
ttk::style map Row \
|
|
86
|
+
-background [list selected $colors(-selectbg)] \
|
|
87
|
+
-foreground [list selected $colors(-selectfg)] ;
|
|
88
|
+
ttk::style map Cell \
|
|
89
|
+
-background [list selected $colors(-selectbg)] \
|
|
90
|
+
-foreground [list selected $colors(-selectfg)] ;
|
|
91
|
+
ttk::style map Item \
|
|
92
|
+
-background [list selected $colors(-selectbg)] \
|
|
93
|
+
-foreground [list selected $colors(-selectfg)] ;
|
|
94
|
+
|
|
95
|
+
ttk::style configure TScale \
|
|
96
|
+
-groovewidth 4 -troughrelief sunken \
|
|
97
|
+
-sliderwidth raised -borderwidth 2
|
|
98
|
+
ttk::style configure TProgressbar \
|
|
99
|
+
-background $colors(-selectbg) -borderwidth 0
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#
|
|
2
|
+
# aquaTheme.tcl,v 1.28 2007/11/19 01:57:21 jenglish Exp
|
|
3
|
+
#
|
|
4
|
+
# Aqua theme (OSX native look and feel)
|
|
5
|
+
#
|
|
6
|
+
|
|
7
|
+
namespace eval ttk::theme::aqua {
|
|
8
|
+
ttk::style theme settings aqua {
|
|
9
|
+
|
|
10
|
+
ttk::style configure . \
|
|
11
|
+
-font System \
|
|
12
|
+
-background White \
|
|
13
|
+
-foreground Black \
|
|
14
|
+
-selectbackground SystemHighlight \
|
|
15
|
+
-selectforeground SystemHighlightText \
|
|
16
|
+
-selectborderwidth 0 \
|
|
17
|
+
-insertwidth 1 \
|
|
18
|
+
;
|
|
19
|
+
ttk::style map . \
|
|
20
|
+
-foreground [list disabled "#7f7f7f" background "#7f7f7f"] \
|
|
21
|
+
-selectbackground [list background "#c3c3c3" !focus "#c3c3c3"] \
|
|
22
|
+
-selectforeground [list background "#a3a3a3" !focus "#000000"] \
|
|
23
|
+
;
|
|
24
|
+
|
|
25
|
+
# Workaround for #1100117:
|
|
26
|
+
# Actually, on Aqua we probably shouldn't stipple images in
|
|
27
|
+
# disabled buttons even if it did work...
|
|
28
|
+
#
|
|
29
|
+
ttk::style configure . -stipple {}
|
|
30
|
+
|
|
31
|
+
ttk::style configure TButton -anchor center -width -6
|
|
32
|
+
ttk::style configure Toolbutton -padding 4
|
|
33
|
+
# See Apple HIG figs 14-63, 14-65
|
|
34
|
+
ttk::style configure TNotebook -tabposition n -padding {20 12}
|
|
35
|
+
ttk::style configure TNotebook.Tab -padding {10 2 10 2}
|
|
36
|
+
|
|
37
|
+
# Combobox:
|
|
38
|
+
ttk::style configure TCombobox -postoffset {5 -2 -10 0}
|
|
39
|
+
|
|
40
|
+
# Treeview:
|
|
41
|
+
ttk::style configure Treeview -rowheight 18
|
|
42
|
+
ttk::style configure Heading -font TkHeadingFont
|
|
43
|
+
ttk::style map Row -background [list \
|
|
44
|
+
{selected background} "#c3c3c3" selected SystemHighlight] ;
|
|
45
|
+
ttk::style map Cell -foreground [list \
|
|
46
|
+
{selected background} "#000000" selected SystemHighlightText] ;
|
|
47
|
+
ttk::style map Item -foreground [list \
|
|
48
|
+
{selected background} "#000000" selected SystemHighlightText] ;
|
|
49
|
+
|
|
50
|
+
# Enable animation for ttk::progressbar widget:
|
|
51
|
+
ttk::style configure TProgressbar -period 100 -maxphase 255
|
|
52
|
+
|
|
53
|
+
# For Aqua, labelframe labels should appear outside the border,
|
|
54
|
+
# with a 14 pixel inset and 4 pixels spacing between border and label
|
|
55
|
+
# (ref: Apple Human Interface Guidelines / Controls / Grouping Controls)
|
|
56
|
+
#
|
|
57
|
+
ttk::style configure TLabelframe \
|
|
58
|
+
-labeloutside true -labelmargins {14 0 14 4}
|
|
59
|
+
|
|
60
|
+
# TODO: panedwindow sashes should be 9 pixels (HIG:Controls:Split Views)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#
|
|
2
|
+
# button.tcl,v 1.14 2006/11/26 17:45:16 jenglish Exp
|
|
3
|
+
#
|
|
4
|
+
# Bindings for Buttons, Checkbuttons, and Radiobuttons.
|
|
5
|
+
#
|
|
6
|
+
# Notes: <Button1-Leave>, <Button1-Enter> only control the "pressed"
|
|
7
|
+
# state; widgets remain "active" if the pointer is dragged out.
|
|
8
|
+
# This doesn't seem to be conventional, but it's a nice way
|
|
9
|
+
# to provide extra feedback while the grab is active.
|
|
10
|
+
# (If the button is released off the widget, the grab deactivates and
|
|
11
|
+
# we get a <Leave> event then, which turns off the "active" state)
|
|
12
|
+
#
|
|
13
|
+
# Normally, <ButtonRelease> and <ButtonN-Enter/Leave> events are
|
|
14
|
+
# delivered to the widget which received the initial <ButtonPress>
|
|
15
|
+
# event. However, Tk [grab]s (#1223103) and menu interactions
|
|
16
|
+
# (#1222605) can interfere with this. To guard against spurious
|
|
17
|
+
# <Button1-Enter> events, the <Button1-Enter> binding only sets
|
|
18
|
+
# the pressed state if the button is currently active.
|
|
19
|
+
#
|
|
20
|
+
|
|
21
|
+
namespace eval ttk::button {}
|
|
22
|
+
|
|
23
|
+
bind TButton <Enter> { %W instate !disabled {%W state active} }
|
|
24
|
+
bind TButton <Leave> { %W state !active }
|
|
25
|
+
bind TButton <Key-space> { ttk::button::activate %W }
|
|
26
|
+
bind TButton <<Invoke>> { ttk::button::activate %W }
|
|
27
|
+
|
|
28
|
+
bind TButton <ButtonPress-1> \
|
|
29
|
+
{ %W instate !disabled { ttk::clickToFocus %W; %W state pressed } }
|
|
30
|
+
bind TButton <ButtonRelease-1> \
|
|
31
|
+
{ %W instate {pressed !disabled} { %W state !pressed; %W invoke } }
|
|
32
|
+
bind TButton <Button1-Leave> \
|
|
33
|
+
{ %W state !pressed }
|
|
34
|
+
bind TButton <Button1-Enter> \
|
|
35
|
+
{ %W instate {active !disabled} { %W state pressed } }
|
|
36
|
+
|
|
37
|
+
# Checkbuttons and Radiobuttons have the same bindings as Buttons:
|
|
38
|
+
#
|
|
39
|
+
ttk::copyBindings TButton TCheckbutton
|
|
40
|
+
ttk::copyBindings TButton TRadiobutton
|
|
41
|
+
|
|
42
|
+
# ...plus a few more:
|
|
43
|
+
|
|
44
|
+
bind TRadiobutton <KeyPress-Up> { ttk::button::RadioTraverse %W -1 }
|
|
45
|
+
bind TRadiobutton <KeyPress-Down> { ttk::button::RadioTraverse %W +1 }
|
|
46
|
+
|
|
47
|
+
# bind TCheckbutton <KeyPress-plus> { %W select }
|
|
48
|
+
# bind TCheckbutton <KeyPress-minus> { %W deselect }
|
|
49
|
+
|
|
50
|
+
# activate --
|
|
51
|
+
# Simulate a button press: temporarily set the state to 'pressed',
|
|
52
|
+
# then invoke the button.
|
|
53
|
+
#
|
|
54
|
+
proc ttk::button::activate {w} {
|
|
55
|
+
$w instate disabled { return }
|
|
56
|
+
set oldState [$w state pressed]
|
|
57
|
+
update idletasks; after 100
|
|
58
|
+
$w state $oldState
|
|
59
|
+
$w invoke
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
# RadioTraverse -- up/down keyboard traversal for radiobutton groups.
|
|
63
|
+
# Set focus to previous/next radiobutton in a group.
|
|
64
|
+
# A radiobutton group consists of all the radiobuttons with
|
|
65
|
+
# the same parent and -variable; this is a pretty good heuristic
|
|
66
|
+
# that works most of the time.
|
|
67
|
+
#
|
|
68
|
+
proc ttk::button::RadioTraverse {w dir} {
|
|
69
|
+
set group [list]
|
|
70
|
+
foreach sibling [winfo children [winfo parent $w]] {
|
|
71
|
+
if { [winfo class $sibling] eq "TRadiobutton"
|
|
72
|
+
&& [$sibling cget -variable] eq [$w cget -variable]
|
|
73
|
+
&& ![$sibling instate disabled]
|
|
74
|
+
} {
|
|
75
|
+
lappend group $sibling
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if {![llength $group]} { # Shouldn't happen, but can.
|
|
80
|
+
return
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
set pos [expr {([lsearch -exact $group $w] + $dir) % [llength $group]}]
|
|
84
|
+
ttk::traverseTo [lindex $group $pos]
|
|
85
|
+
}
|