Pratt 1.5.6
Sign up to get free protection for your applications and to get access to all the features.
- 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,61 @@
|
|
1
|
+
/*
|
2
|
+
* ttkStubInit.c,v 1.4 2006/08/26 23:06:47 jenglish Exp
|
3
|
+
*
|
4
|
+
* This file is (mostly) automatically generated from ttk.decls.
|
5
|
+
* It is compiled and linked in with the tile package proper.
|
6
|
+
*/
|
7
|
+
|
8
|
+
#include "tk.h"
|
9
|
+
#include "tkTheme.h"
|
10
|
+
|
11
|
+
/* !BEGIN!: Do not edit below this line. */
|
12
|
+
|
13
|
+
TtkStubs ttkStubs = {
|
14
|
+
TCL_STUB_MAGIC,
|
15
|
+
TTK_STUBS_EPOCH,
|
16
|
+
TTK_STUBS_REVISION,
|
17
|
+
0,
|
18
|
+
Ttk_GetTheme, /* 0 */
|
19
|
+
Ttk_GetDefaultTheme, /* 1 */
|
20
|
+
Ttk_GetCurrentTheme, /* 2 */
|
21
|
+
Ttk_CreateTheme, /* 3 */
|
22
|
+
Ttk_RegisterCleanup, /* 4 */
|
23
|
+
Ttk_RegisterElementSpec, /* 5 */
|
24
|
+
Ttk_RegisterElement, /* 6 */
|
25
|
+
Ttk_RegisterElementFactory, /* 7 */
|
26
|
+
Ttk_RegisterLayout, /* 8 */
|
27
|
+
0, /* 9 */
|
28
|
+
Ttk_GetStateSpecFromObj, /* 10 */
|
29
|
+
Ttk_NewStateSpecObj, /* 11 */
|
30
|
+
Ttk_GetStateMapFromObj, /* 12 */
|
31
|
+
Ttk_StateMapLookup, /* 13 */
|
32
|
+
Ttk_StateTableLookup, /* 14 */
|
33
|
+
0, /* 15 */
|
34
|
+
0, /* 16 */
|
35
|
+
0, /* 17 */
|
36
|
+
0, /* 18 */
|
37
|
+
0, /* 19 */
|
38
|
+
Ttk_GetPaddingFromObj, /* 20 */
|
39
|
+
Ttk_GetBorderFromObj, /* 21 */
|
40
|
+
Ttk_GetStickyFromObj, /* 22 */
|
41
|
+
Ttk_MakePadding, /* 23 */
|
42
|
+
Ttk_UniformPadding, /* 24 */
|
43
|
+
Ttk_AddPadding, /* 25 */
|
44
|
+
Ttk_RelievePadding, /* 26 */
|
45
|
+
Ttk_MakeBox, /* 27 */
|
46
|
+
Ttk_BoxContains, /* 28 */
|
47
|
+
Ttk_PackBox, /* 29 */
|
48
|
+
Ttk_StickBox, /* 30 */
|
49
|
+
Ttk_AnchorBox, /* 31 */
|
50
|
+
Ttk_PadBox, /* 32 */
|
51
|
+
Ttk_ExpandBox, /* 33 */
|
52
|
+
Ttk_PlaceBox, /* 34 */
|
53
|
+
Ttk_NewBoxObj, /* 35 */
|
54
|
+
0, /* 36 */
|
55
|
+
0, /* 37 */
|
56
|
+
0, /* 38 */
|
57
|
+
0, /* 39 */
|
58
|
+
Ttk_GetOrientFromObj, /* 40 */
|
59
|
+
};
|
60
|
+
|
61
|
+
/* !END!: Do not edit above this line. */
|
@@ -0,0 +1,70 @@
|
|
1
|
+
/*
|
2
|
+
* ttkStubLib.c,v 1.4 2006/11/11 22:16:41 jenglish Exp
|
3
|
+
* SOURCE: tk/generic/tkStubLib.c, version 1.9 2004/03/17
|
4
|
+
*/
|
5
|
+
|
6
|
+
#include "tk.h"
|
7
|
+
|
8
|
+
#define USE_TTK_STUBS 1
|
9
|
+
#include "tkTheme.h"
|
10
|
+
|
11
|
+
const TtkStubs *ttkStubsPtr;
|
12
|
+
|
13
|
+
/*
|
14
|
+
*----------------------------------------------------------------------
|
15
|
+
*
|
16
|
+
* TtkInitializeStubs --
|
17
|
+
* Load the tile package, initialize stub table pointer.
|
18
|
+
* Do not call this function directly, use Ttk_InitStubs() macro instead.
|
19
|
+
*
|
20
|
+
* Results:
|
21
|
+
* The actual version of the package that satisfies the request, or
|
22
|
+
* NULL to indicate that an error occurred.
|
23
|
+
*
|
24
|
+
* Side effects:
|
25
|
+
* Sets the stub table pointer.
|
26
|
+
*
|
27
|
+
*/
|
28
|
+
const char *
|
29
|
+
TtkInitializeStubs(
|
30
|
+
Tcl_Interp *interp, const char *version, int epoch, int revision)
|
31
|
+
{
|
32
|
+
int exact = 0;
|
33
|
+
const char *packageName = "tile";
|
34
|
+
const char *errMsg = NULL;
|
35
|
+
ClientData pkgClientData = NULL;
|
36
|
+
const char *actualVersion= Tcl_PkgRequireEx(
|
37
|
+
interp, packageName, version, exact, &pkgClientData);
|
38
|
+
TtkStubs *stubsPtr = pkgClientData;
|
39
|
+
|
40
|
+
if (!actualVersion) {
|
41
|
+
return NULL;
|
42
|
+
}
|
43
|
+
|
44
|
+
if (!stubsPtr) {
|
45
|
+
errMsg = "missing stub table pointer";
|
46
|
+
goto error;
|
47
|
+
}
|
48
|
+
if (stubsPtr->epoch != epoch) {
|
49
|
+
errMsg = "epoch number mismatch";
|
50
|
+
goto error;
|
51
|
+
}
|
52
|
+
if (stubsPtr->revision < revision) {
|
53
|
+
errMsg = "require later revision";
|
54
|
+
goto error;
|
55
|
+
}
|
56
|
+
|
57
|
+
ttkStubsPtr = stubsPtr;
|
58
|
+
return actualVersion;
|
59
|
+
|
60
|
+
error:
|
61
|
+
Tcl_ResetResult(interp);
|
62
|
+
Tcl_AppendResult(interp,
|
63
|
+
"Error loading ", packageName, " package",
|
64
|
+
" (requested version '", version,
|
65
|
+
"', loaded version '", actualVersion, "'): ",
|
66
|
+
errMsg,
|
67
|
+
NULL);
|
68
|
+
return NULL;
|
69
|
+
}
|
70
|
+
|
@@ -0,0 +1,785 @@
|
|
1
|
+
/* widget.c,v 1.52 2007/10/30 14:58:59 jenglish Exp
|
2
|
+
* Copyright (c) 2003, Joe English
|
3
|
+
*
|
4
|
+
* Core widget utilities.
|
5
|
+
*/
|
6
|
+
|
7
|
+
#include <string.h>
|
8
|
+
#include <tk.h>
|
9
|
+
#include "tkTheme.h"
|
10
|
+
#include "widget.h"
|
11
|
+
|
12
|
+
/*------------------------------------------------------------------------
|
13
|
+
* +++ Internal helper routines.
|
14
|
+
*/
|
15
|
+
|
16
|
+
/* UpdateLayout --
|
17
|
+
* Call the widget's get-layout hook to recompute corePtr->layout.
|
18
|
+
* Returns TCL_OK if successful, returns TCL_ERROR and leaves
|
19
|
+
* the layout unchanged otherwise.
|
20
|
+
*/
|
21
|
+
static int UpdateLayout(Tcl_Interp *interp, WidgetCore *corePtr)
|
22
|
+
{
|
23
|
+
Ttk_Theme themePtr = Ttk_GetCurrentTheme(interp);
|
24
|
+
Ttk_Layout newLayout =
|
25
|
+
corePtr->widgetSpec->getLayoutProc(interp, themePtr,corePtr);
|
26
|
+
|
27
|
+
if (newLayout) {
|
28
|
+
if (corePtr->layout) {
|
29
|
+
Ttk_FreeLayout(corePtr->layout);
|
30
|
+
}
|
31
|
+
corePtr->layout = newLayout;
|
32
|
+
return TCL_OK;
|
33
|
+
}
|
34
|
+
return TCL_ERROR;
|
35
|
+
}
|
36
|
+
|
37
|
+
/* SizeChanged --
|
38
|
+
* Call the widget's sizeProc to compute new requested size
|
39
|
+
* and pass it to the geometry manager.
|
40
|
+
*/
|
41
|
+
static void SizeChanged(WidgetCore *corePtr)
|
42
|
+
{
|
43
|
+
int reqWidth = 1, reqHeight = 1;
|
44
|
+
|
45
|
+
if (corePtr->widgetSpec->sizeProc(corePtr,&reqWidth,&reqHeight)) {
|
46
|
+
Tk_GeometryRequest(corePtr->tkwin, reqWidth, reqHeight);
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
#ifndef TK_NO_DOUBLE_BUFFERING
|
51
|
+
|
52
|
+
/* BeginDrawing --
|
53
|
+
* Returns a Drawable for drawing the widget contents.
|
54
|
+
* This is normally an off-screen Pixmap, copied to
|
55
|
+
* the window by EndDrawing().
|
56
|
+
*/
|
57
|
+
static Drawable BeginDrawing(Tk_Window tkwin)
|
58
|
+
{
|
59
|
+
return Tk_GetPixmap(Tk_Display(tkwin), Tk_WindowId(tkwin),
|
60
|
+
Tk_Width(tkwin), Tk_Height(tkwin),
|
61
|
+
DefaultDepthOfScreen(Tk_Screen(tkwin)));
|
62
|
+
}
|
63
|
+
|
64
|
+
/* EndDrawing --
|
65
|
+
* Copy the drawable contents to the screen and release resources.
|
66
|
+
*/
|
67
|
+
static void EndDrawing(Tk_Window tkwin, Drawable d)
|
68
|
+
{
|
69
|
+
XGCValues gcValues;
|
70
|
+
GC gc;
|
71
|
+
|
72
|
+
gcValues.function = GXcopy;
|
73
|
+
gcValues.graphics_exposures = False;
|
74
|
+
gc = Tk_GetGC(tkwin, GCFunction|GCGraphicsExposures, &gcValues);
|
75
|
+
|
76
|
+
XCopyArea(Tk_Display(tkwin), d, Tk_WindowId(tkwin), gc,
|
77
|
+
0, 0, (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin),
|
78
|
+
0, 0);
|
79
|
+
|
80
|
+
Tk_FreePixmap(Tk_Display(tkwin), d);
|
81
|
+
Tk_FreeGC(Tk_Display(tkwin), gc);
|
82
|
+
}
|
83
|
+
#else
|
84
|
+
/* No double-buffering: draw directly into the window. */
|
85
|
+
static Drawable BeginDrawing(Tk_Window tkwin) { return Tk_WindowId(tkwin); }
|
86
|
+
static void EndDrawing(Tk_Window tkwin, Drawable d) { }
|
87
|
+
#endif
|
88
|
+
|
89
|
+
/* DrawWidget --
|
90
|
+
* Redraw a widget. Called as an idle handler.
|
91
|
+
*/
|
92
|
+
static void DrawWidget(ClientData recordPtr)
|
93
|
+
{
|
94
|
+
WidgetCore *corePtr = recordPtr;
|
95
|
+
|
96
|
+
corePtr->flags &= ~REDISPLAY_PENDING;
|
97
|
+
if (Tk_IsMapped(corePtr->tkwin)) {
|
98
|
+
Drawable d = BeginDrawing(corePtr->tkwin);
|
99
|
+
corePtr->widgetSpec->layoutProc(recordPtr);
|
100
|
+
corePtr->widgetSpec->displayProc(recordPtr, d);
|
101
|
+
EndDrawing(corePtr->tkwin, d);
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
/* TtkRedisplayWidget --
|
106
|
+
* Schedule redisplay as an idle handler.
|
107
|
+
*/
|
108
|
+
void TtkRedisplayWidget(WidgetCore *corePtr)
|
109
|
+
{
|
110
|
+
if (corePtr->flags & WIDGET_DESTROYED) {
|
111
|
+
return;
|
112
|
+
}
|
113
|
+
|
114
|
+
if (!(corePtr->flags & REDISPLAY_PENDING)) {
|
115
|
+
Tcl_DoWhenIdle(DrawWidget, (ClientData) corePtr);
|
116
|
+
corePtr->flags |= REDISPLAY_PENDING;
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
/* TtkResizeWidget --
|
121
|
+
* Recompute widget size, schedule geometry propagation and redisplay.
|
122
|
+
*/
|
123
|
+
void TtkResizeWidget(WidgetCore *corePtr)
|
124
|
+
{
|
125
|
+
if (corePtr->flags & WIDGET_DESTROYED) {
|
126
|
+
return;
|
127
|
+
}
|
128
|
+
|
129
|
+
SizeChanged(corePtr);
|
130
|
+
TtkRedisplayWidget(corePtr);
|
131
|
+
}
|
132
|
+
|
133
|
+
/* TtkWidgetChangeState --
|
134
|
+
* Set / clear the specified bits in the 'state' flag,
|
135
|
+
*/
|
136
|
+
void TtkWidgetChangeState(WidgetCore *corePtr,
|
137
|
+
unsigned int setBits, unsigned int clearBits)
|
138
|
+
{
|
139
|
+
Ttk_State oldState = corePtr->state;
|
140
|
+
corePtr->state = (oldState & ~clearBits) | setBits;
|
141
|
+
if (corePtr->state ^ oldState) {
|
142
|
+
TtkRedisplayWidget(corePtr);
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
/* TtkWidgetEnsembleCommand --
|
147
|
+
* Invoke an ensemble defined by a WidgetCommandSpec.
|
148
|
+
*/
|
149
|
+
int TtkWidgetEnsembleCommand(
|
150
|
+
const WidgetCommandSpec *commands, /* Ensemble definition */
|
151
|
+
int cmdIndex, /* Index of command word */
|
152
|
+
Tcl_Interp *interp, /* Interpreter to use */
|
153
|
+
int objc, Tcl_Obj *const objv[], /* Argument vector */
|
154
|
+
void *clientData) /* User data (widget record pointer) */
|
155
|
+
{
|
156
|
+
int index;
|
157
|
+
|
158
|
+
if (objc <= cmdIndex) {
|
159
|
+
Tcl_WrongNumArgs(interp, cmdIndex, objv, "option ?arg arg...?");
|
160
|
+
return TCL_ERROR;
|
161
|
+
}
|
162
|
+
if (Tcl_GetIndexFromObjStruct(interp, objv[cmdIndex], commands,
|
163
|
+
sizeof(commands[0]), "command", 0, &index) != TCL_OK)
|
164
|
+
{
|
165
|
+
return TCL_ERROR;
|
166
|
+
}
|
167
|
+
return commands[index].command(interp, objc, objv, clientData);
|
168
|
+
}
|
169
|
+
|
170
|
+
/*
|
171
|
+
* WidgetInstanceObjCmd --
|
172
|
+
* Widget instance command implementation.
|
173
|
+
*/
|
174
|
+
static int
|
175
|
+
WidgetInstanceObjCmd(
|
176
|
+
ClientData clientData, /* Widget record pointer */
|
177
|
+
Tcl_Interp *interp, /* Current interpreter. */
|
178
|
+
int objc, /* Number of arguments. */
|
179
|
+
Tcl_Obj * const objv[]) /* Argument objects. */
|
180
|
+
{
|
181
|
+
WidgetCore *corePtr = (WidgetCore *)clientData;
|
182
|
+
const WidgetCommandSpec *commands = corePtr->widgetSpec->commands;
|
183
|
+
int status = TCL_OK;
|
184
|
+
|
185
|
+
Tcl_Preserve(clientData);
|
186
|
+
status = TtkWidgetEnsembleCommand(commands,1, interp,objc,objv,clientData);
|
187
|
+
Tcl_Release(clientData);
|
188
|
+
|
189
|
+
return status;
|
190
|
+
}
|
191
|
+
|
192
|
+
/*
|
193
|
+
* Command deletion callback for widget instance commands.
|
194
|
+
*/
|
195
|
+
static void
|
196
|
+
WidgetInstanceObjCmdDeleted(ClientData clientData)
|
197
|
+
{
|
198
|
+
WidgetCore *corePtr = (WidgetCore *) clientData;
|
199
|
+
corePtr->widgetCmd = NULL;
|
200
|
+
if (corePtr->tkwin != NULL)
|
201
|
+
Tk_DestroyWindow(corePtr->tkwin);
|
202
|
+
}
|
203
|
+
|
204
|
+
/*
|
205
|
+
* WidgetCleanup --
|
206
|
+
* Final cleanup for widget.
|
207
|
+
*
|
208
|
+
* @@@ TODO: check all code paths leading to widget destruction,
|
209
|
+
* @@@ describe here.
|
210
|
+
* @@@ Call widget-specific cleanup routine at an appropriate point.
|
211
|
+
*/
|
212
|
+
static void
|
213
|
+
WidgetCleanup(char *memPtr)
|
214
|
+
{
|
215
|
+
ckfree(memPtr);
|
216
|
+
}
|
217
|
+
|
218
|
+
/*
|
219
|
+
* CoreEventProc --
|
220
|
+
* Event handler for basic events.
|
221
|
+
* Processes Expose, Configure, FocusIn/Out, and Destroy events.
|
222
|
+
* Also handles <<ThemeChanged>> virtual events.
|
223
|
+
*
|
224
|
+
* For Expose and Configure, simply schedule the widget for redisplay.
|
225
|
+
* For Destroy events, handle the cleanup process.
|
226
|
+
*
|
227
|
+
* For Focus events, set/clear the focus bit in the state field.
|
228
|
+
* It turns out this is impossible to do correctly in a binding script,
|
229
|
+
* because Tk filters out focus events with detail == NotifyInferior.
|
230
|
+
*
|
231
|
+
* For Deactivate/Activate pseudo-events, clear/set the background state flag.
|
232
|
+
*
|
233
|
+
* <<NOTE-REALIZED>> On the first ConfigureNotify event
|
234
|
+
* (which indicates that the window has just been created),
|
235
|
+
* update the layout. This is to work around two problems:
|
236
|
+
* (1) Virtual events aren't delivered to unrealized widgets
|
237
|
+
* (see bug #835997), so any intervening <<ThemeChanged>> events
|
238
|
+
* will not have been processed.
|
239
|
+
*
|
240
|
+
* (2) Geometry calculations in the XP theme don't work
|
241
|
+
* until the widget is realized.
|
242
|
+
*/
|
243
|
+
|
244
|
+
static const unsigned CoreEventMask
|
245
|
+
= ExposureMask
|
246
|
+
| StructureNotifyMask
|
247
|
+
| FocusChangeMask
|
248
|
+
| VirtualEventMask
|
249
|
+
| ActivateMask
|
250
|
+
;
|
251
|
+
|
252
|
+
static void CoreEventProc(ClientData clientData, XEvent *eventPtr)
|
253
|
+
{
|
254
|
+
WidgetCore *corePtr = (WidgetCore *) clientData;
|
255
|
+
|
256
|
+
switch (eventPtr->type)
|
257
|
+
{
|
258
|
+
case ConfigureNotify :
|
259
|
+
if (!(corePtr->flags & WIDGET_REALIZED)) {
|
260
|
+
/* See <<NOTE-REALIZED>> */
|
261
|
+
(void)UpdateLayout(corePtr->interp, corePtr);
|
262
|
+
SizeChanged(corePtr);
|
263
|
+
corePtr->flags |= WIDGET_REALIZED;
|
264
|
+
}
|
265
|
+
TtkRedisplayWidget(corePtr);
|
266
|
+
break;
|
267
|
+
case Expose :
|
268
|
+
if (eventPtr->xexpose.count == 0) {
|
269
|
+
TtkRedisplayWidget(corePtr);
|
270
|
+
}
|
271
|
+
break;
|
272
|
+
case DestroyNotify :
|
273
|
+
corePtr->flags |= WIDGET_DESTROYED;
|
274
|
+
|
275
|
+
Tk_DeleteEventHandler(corePtr->tkwin,
|
276
|
+
CoreEventMask,CoreEventProc,clientData);
|
277
|
+
|
278
|
+
if (corePtr->flags & REDISPLAY_PENDING) {
|
279
|
+
Tcl_CancelIdleCall(DrawWidget, clientData);
|
280
|
+
}
|
281
|
+
|
282
|
+
corePtr->widgetSpec->cleanupProc(corePtr);
|
283
|
+
|
284
|
+
Tk_FreeConfigOptions(
|
285
|
+
clientData, corePtr->optionTable, corePtr->tkwin);
|
286
|
+
corePtr->tkwin = NULL;
|
287
|
+
|
288
|
+
if (corePtr->layout) {
|
289
|
+
Ttk_FreeLayout(corePtr->layout);
|
290
|
+
}
|
291
|
+
|
292
|
+
/* NB: this can reenter the interpreter via a command traces */
|
293
|
+
if (corePtr->widgetCmd) {
|
294
|
+
Tcl_Command cmd = corePtr->widgetCmd;
|
295
|
+
corePtr->widgetCmd = 0;
|
296
|
+
Tcl_DeleteCommandFromToken(corePtr->interp, cmd);
|
297
|
+
}
|
298
|
+
Tcl_EventuallyFree(clientData, WidgetCleanup);
|
299
|
+
break;
|
300
|
+
|
301
|
+
case FocusIn:
|
302
|
+
case FocusOut:
|
303
|
+
/* Don't process "virtual crossing" events */
|
304
|
+
if ( eventPtr->xfocus.detail == NotifyInferior
|
305
|
+
|| eventPtr->xfocus.detail == NotifyAncestor
|
306
|
+
|| eventPtr->xfocus.detail == NotifyNonlinear)
|
307
|
+
{
|
308
|
+
if (eventPtr->type == FocusIn)
|
309
|
+
corePtr->state |= TTK_STATE_FOCUS;
|
310
|
+
else
|
311
|
+
corePtr->state &= ~TTK_STATE_FOCUS;
|
312
|
+
TtkRedisplayWidget(corePtr);
|
313
|
+
}
|
314
|
+
break;
|
315
|
+
case ActivateNotify:
|
316
|
+
corePtr->state &= ~TTK_STATE_BACKGROUND;
|
317
|
+
TtkRedisplayWidget(corePtr);
|
318
|
+
break;
|
319
|
+
case DeactivateNotify:
|
320
|
+
corePtr->state |= TTK_STATE_BACKGROUND;
|
321
|
+
TtkRedisplayWidget(corePtr);
|
322
|
+
break;
|
323
|
+
case VirtualEvent:
|
324
|
+
if (!strcmp("ThemeChanged", ((XVirtualEvent *)(eventPtr))->name)) {
|
325
|
+
(void)UpdateLayout(corePtr->interp, corePtr);
|
326
|
+
SizeChanged(corePtr);
|
327
|
+
TtkRedisplayWidget(corePtr);
|
328
|
+
}
|
329
|
+
default:
|
330
|
+
/* can't happen... */
|
331
|
+
break;
|
332
|
+
}
|
333
|
+
}
|
334
|
+
|
335
|
+
/*
|
336
|
+
* WidgetWorldChanged --
|
337
|
+
* Default Tk_ClassWorldChangedProc() for widgets.
|
338
|
+
* Invoked whenever fonts or other system resources are changed;
|
339
|
+
* recomputes geometry.
|
340
|
+
*/
|
341
|
+
static void WidgetWorldChanged(ClientData clientData)
|
342
|
+
{
|
343
|
+
WidgetCore *corePtr = (WidgetCore*)clientData;
|
344
|
+
SizeChanged(corePtr);
|
345
|
+
TtkRedisplayWidget(corePtr);
|
346
|
+
}
|
347
|
+
|
348
|
+
static struct Tk_ClassProcs widgetClassProcs = {
|
349
|
+
sizeof(Tk_ClassProcs),
|
350
|
+
WidgetWorldChanged
|
351
|
+
};
|
352
|
+
|
353
|
+
/*
|
354
|
+
* TtkWidgetConstructorObjCmd --
|
355
|
+
* General-purpose widget constructor command implementation.
|
356
|
+
* ClientData is a WidgetSpec *.
|
357
|
+
*/
|
358
|
+
int TtkWidgetConstructorObjCmd(
|
359
|
+
ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
|
360
|
+
{
|
361
|
+
WidgetSpec *widgetSpec = (WidgetSpec *)clientData;
|
362
|
+
const char *className = widgetSpec->className;
|
363
|
+
WidgetCore *corePtr;
|
364
|
+
ClientData recordPtr;
|
365
|
+
Tk_Window tkwin;
|
366
|
+
Tk_OptionTable optionTable;
|
367
|
+
int i;
|
368
|
+
|
369
|
+
if (objc < 2 || objc % 1 == 1) {
|
370
|
+
Tcl_WrongNumArgs(interp, 1, objv, "pathName ?options?");
|
371
|
+
return TCL_ERROR;
|
372
|
+
}
|
373
|
+
|
374
|
+
tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp),
|
375
|
+
Tcl_GetStringFromObj(objv[1], NULL), (char *) NULL);
|
376
|
+
if (tkwin == NULL)
|
377
|
+
return TCL_ERROR;
|
378
|
+
|
379
|
+
/*
|
380
|
+
* Check if a -class resource has been specified:
|
381
|
+
* We have to do this before the InitOptions() call,
|
382
|
+
* since InitOptions() is affected by the widget class.
|
383
|
+
*/
|
384
|
+
for (i = 2; i < objc; i += 2) {
|
385
|
+
const char *resourceName = Tcl_GetString(objv[i]);
|
386
|
+
if (!strcmp(resourceName, "-class")) {
|
387
|
+
className = Tcl_GetString(objv[i+1]);
|
388
|
+
break;
|
389
|
+
}
|
390
|
+
}
|
391
|
+
|
392
|
+
Tk_SetClass(tkwin, className);
|
393
|
+
|
394
|
+
/*
|
395
|
+
* Set the BackgroundPixmap to ParentRelative here, so
|
396
|
+
* subclasses don't need to worry about setting the background.
|
397
|
+
*/
|
398
|
+
Tk_SetWindowBackgroundPixmap(tkwin, ParentRelative);
|
399
|
+
|
400
|
+
optionTable = Tk_CreateOptionTable(interp, widgetSpec->optionSpecs);
|
401
|
+
|
402
|
+
/*
|
403
|
+
* Allocate and initialize the widget record.
|
404
|
+
*/
|
405
|
+
recordPtr = ckalloc(widgetSpec->recordSize);
|
406
|
+
memset(recordPtr, 0, widgetSpec->recordSize);
|
407
|
+
corePtr = (WidgetCore *)recordPtr;
|
408
|
+
|
409
|
+
corePtr->tkwin = tkwin;
|
410
|
+
corePtr->interp = interp;
|
411
|
+
corePtr->widgetSpec = widgetSpec;
|
412
|
+
corePtr->widgetCmd = Tcl_CreateObjCommand(interp, Tk_PathName(tkwin),
|
413
|
+
WidgetInstanceObjCmd, recordPtr, WidgetInstanceObjCmdDeleted);
|
414
|
+
corePtr->optionTable = optionTable;
|
415
|
+
|
416
|
+
Tk_SetClassProcs(tkwin, &widgetClassProcs, recordPtr);
|
417
|
+
|
418
|
+
if (Tk_InitOptions(interp, recordPtr, optionTable, tkwin) != TCL_OK)
|
419
|
+
goto error_nocleanup;
|
420
|
+
|
421
|
+
if (widgetSpec->initializeProc(interp, recordPtr) != TCL_OK)
|
422
|
+
goto error_nocleanup;
|
423
|
+
|
424
|
+
if (Tk_SetOptions(interp, recordPtr, optionTable, objc - 2,
|
425
|
+
objv + 2, tkwin, NULL/*savePtr*/, (int *)NULL/*maskPtr*/) != TCL_OK)
|
426
|
+
goto error;
|
427
|
+
|
428
|
+
if (widgetSpec->configureProc(interp, recordPtr, ~0) != TCL_OK)
|
429
|
+
goto error;
|
430
|
+
|
431
|
+
if (widgetSpec->postConfigureProc(interp, recordPtr, ~0) != TCL_OK)
|
432
|
+
goto error;
|
433
|
+
|
434
|
+
if (WidgetDestroyed(corePtr))
|
435
|
+
goto error;
|
436
|
+
|
437
|
+
if (UpdateLayout(interp, corePtr) != TCL_OK)
|
438
|
+
goto error;
|
439
|
+
|
440
|
+
SizeChanged(corePtr);
|
441
|
+
Tk_CreateEventHandler(tkwin, CoreEventMask, CoreEventProc, recordPtr);
|
442
|
+
|
443
|
+
Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(tkwin), -1));
|
444
|
+
|
445
|
+
return TCL_OK;
|
446
|
+
|
447
|
+
error:
|
448
|
+
widgetSpec->cleanupProc(recordPtr);
|
449
|
+
error_nocleanup:
|
450
|
+
if (corePtr->layout) {
|
451
|
+
Ttk_FreeLayout(corePtr->layout);
|
452
|
+
corePtr->layout = 0;
|
453
|
+
}
|
454
|
+
Tk_FreeConfigOptions(recordPtr, optionTable, tkwin);
|
455
|
+
Tk_DestroyWindow(tkwin);
|
456
|
+
corePtr->tkwin = 0;
|
457
|
+
Tcl_DeleteCommandFromToken(interp, corePtr->widgetCmd);
|
458
|
+
ckfree(recordPtr);
|
459
|
+
return TCL_ERROR;
|
460
|
+
}
|
461
|
+
|
462
|
+
/*------------------------------------------------------------------------
|
463
|
+
* +++ Default implementations for widget hook procedures.
|
464
|
+
*/
|
465
|
+
|
466
|
+
/* TtkWidgetGetLayout --
|
467
|
+
* Default getLayoutProc.
|
468
|
+
* Looks up the layout based on the -style resource (if specified),
|
469
|
+
* otherwise use the widget class.
|
470
|
+
*/
|
471
|
+
Ttk_Layout TtkWidgetGetLayout(
|
472
|
+
Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr)
|
473
|
+
{
|
474
|
+
WidgetCore *corePtr = recordPtr;
|
475
|
+
const char *styleName = 0;
|
476
|
+
|
477
|
+
if (corePtr->styleObj)
|
478
|
+
styleName = Tcl_GetString(corePtr->styleObj);
|
479
|
+
|
480
|
+
if (!styleName || *styleName == '\0')
|
481
|
+
styleName = corePtr->widgetSpec->className;
|
482
|
+
|
483
|
+
return Ttk_CreateLayout(interp, themePtr, styleName,
|
484
|
+
recordPtr, corePtr->optionTable, corePtr->tkwin);
|
485
|
+
}
|
486
|
+
|
487
|
+
/*
|
488
|
+
* TtkWidgetGetOrientedLayout --
|
489
|
+
* Helper routine. Same as TtkWidgetGetLayout, but prefixes
|
490
|
+
* "Horizontal." or "Vertical." to the style name, depending
|
491
|
+
* on the value of the 'orient' option.
|
492
|
+
*/
|
493
|
+
Ttk_Layout TtkWidgetGetOrientedLayout(
|
494
|
+
Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr, Tcl_Obj *orientObj)
|
495
|
+
{
|
496
|
+
WidgetCore *corePtr = recordPtr;
|
497
|
+
const char *baseStyleName = 0;
|
498
|
+
Tcl_DString styleName;
|
499
|
+
int orient = TTK_ORIENT_HORIZONTAL;
|
500
|
+
Ttk_Layout layout;
|
501
|
+
|
502
|
+
Tcl_DStringInit(&styleName);
|
503
|
+
|
504
|
+
/* Prefix:
|
505
|
+
*/
|
506
|
+
Ttk_GetOrientFromObj(NULL, orientObj, &orient);
|
507
|
+
if (orient == TTK_ORIENT_HORIZONTAL)
|
508
|
+
Tcl_DStringAppend(&styleName, "Horizontal.", -1);
|
509
|
+
else
|
510
|
+
Tcl_DStringAppend(&styleName, "Vertical.", -1);
|
511
|
+
|
512
|
+
/* Add base style name:
|
513
|
+
*/
|
514
|
+
if (corePtr->styleObj)
|
515
|
+
baseStyleName = Tcl_GetString(corePtr->styleObj);
|
516
|
+
if (!baseStyleName || *baseStyleName == '\0')
|
517
|
+
baseStyleName = corePtr->widgetSpec->className;
|
518
|
+
|
519
|
+
Tcl_DStringAppend(&styleName, baseStyleName, -1);
|
520
|
+
|
521
|
+
/* Create layout:
|
522
|
+
*/
|
523
|
+
layout= Ttk_CreateLayout(interp, themePtr, Tcl_DStringValue(&styleName),
|
524
|
+
recordPtr, corePtr->optionTable, corePtr->tkwin);
|
525
|
+
|
526
|
+
Tcl_DStringFree(&styleName);
|
527
|
+
|
528
|
+
return layout;
|
529
|
+
}
|
530
|
+
|
531
|
+
/* TtkNullInitialize --
|
532
|
+
* Default widget initializeProc (no-op)
|
533
|
+
*/
|
534
|
+
int TtkNullInitialize(Tcl_Interp *interp, void *recordPtr)
|
535
|
+
{
|
536
|
+
return TCL_OK;
|
537
|
+
}
|
538
|
+
|
539
|
+
/* TtkNullPostConfigure --
|
540
|
+
* Default widget postConfigureProc (no-op)
|
541
|
+
*/
|
542
|
+
int TtkNullPostConfigure(Tcl_Interp *interp, void *clientData, int mask)
|
543
|
+
{
|
544
|
+
return TCL_OK;
|
545
|
+
}
|
546
|
+
|
547
|
+
/* TtkCoreConfigure --
|
548
|
+
* Default widget configureProc.
|
549
|
+
* Handles -style option.
|
550
|
+
*/
|
551
|
+
int TtkCoreConfigure(Tcl_Interp *interp, void *clientData, int mask)
|
552
|
+
{
|
553
|
+
WidgetCore *corePtr = clientData;
|
554
|
+
int status = TCL_OK;
|
555
|
+
|
556
|
+
if (mask & STYLE_CHANGED) {
|
557
|
+
status = UpdateLayout(interp, corePtr);
|
558
|
+
}
|
559
|
+
|
560
|
+
return status;
|
561
|
+
}
|
562
|
+
|
563
|
+
/* TtkNullCleanup --
|
564
|
+
* Default widget cleanupProc (no-op)
|
565
|
+
*/
|
566
|
+
void TtkNullCleanup(void *recordPtr)
|
567
|
+
{
|
568
|
+
return;
|
569
|
+
}
|
570
|
+
|
571
|
+
/* TtkWidgetDoLayout --
|
572
|
+
* Default widget layoutProc.
|
573
|
+
*/
|
574
|
+
void TtkWidgetDoLayout(void *clientData)
|
575
|
+
{
|
576
|
+
WidgetCore *corePtr = clientData;
|
577
|
+
Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin));
|
578
|
+
}
|
579
|
+
|
580
|
+
/* TtkWidgetDisplay --
|
581
|
+
* Default widget displayProc.
|
582
|
+
*/
|
583
|
+
void TtkWidgetDisplay(void *recordPtr, Drawable d)
|
584
|
+
{
|
585
|
+
WidgetCore *corePtr = recordPtr;
|
586
|
+
Ttk_DrawLayout(corePtr->layout, corePtr->state, d);
|
587
|
+
}
|
588
|
+
|
589
|
+
/* TtkWidgetSize --
|
590
|
+
* Default widget sizeProc()
|
591
|
+
*/
|
592
|
+
int TtkWidgetSize(void *recordPtr, int *widthPtr, int *heightPtr)
|
593
|
+
{
|
594
|
+
WidgetCore *corePtr = recordPtr;
|
595
|
+
Ttk_LayoutSize(corePtr->layout, corePtr->state, widthPtr, heightPtr);
|
596
|
+
return 1;
|
597
|
+
}
|
598
|
+
|
599
|
+
/*------------------------------------------------------------------------
|
600
|
+
* +++ Default implementations for widget subcommands.
|
601
|
+
*/
|
602
|
+
|
603
|
+
/* $w cget -option
|
604
|
+
*/
|
605
|
+
int TtkWidgetCgetCommand(
|
606
|
+
Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[], void *recordPtr)
|
607
|
+
{
|
608
|
+
WidgetCore *corePtr = recordPtr;
|
609
|
+
Tcl_Obj *result;
|
610
|
+
|
611
|
+
if (objc != 3) {
|
612
|
+
Tcl_WrongNumArgs(interp, 2, objv, "option");
|
613
|
+
return TCL_ERROR;
|
614
|
+
}
|
615
|
+
result = Tk_GetOptionValue(interp, recordPtr,
|
616
|
+
corePtr->optionTable, objv[2], corePtr->tkwin);
|
617
|
+
if (result == NULL)
|
618
|
+
return TCL_ERROR;
|
619
|
+
Tcl_SetObjResult(interp, result);
|
620
|
+
return TCL_OK;
|
621
|
+
}
|
622
|
+
|
623
|
+
/* $w configure ?-option ?value ....??
|
624
|
+
*/
|
625
|
+
int TtkWidgetConfigureCommand(
|
626
|
+
Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
|
627
|
+
{
|
628
|
+
WidgetCore *corePtr = recordPtr;
|
629
|
+
Tcl_Obj *result;
|
630
|
+
|
631
|
+
if (objc == 2) {
|
632
|
+
result = Tk_GetOptionInfo(interp, recordPtr,
|
633
|
+
corePtr->optionTable, (Tcl_Obj *) NULL, corePtr->tkwin);
|
634
|
+
} else if (objc == 3) {
|
635
|
+
result = Tk_GetOptionInfo(interp, recordPtr,
|
636
|
+
corePtr->optionTable, objv[2], corePtr->tkwin);
|
637
|
+
} else {
|
638
|
+
Tk_SavedOptions savedOptions;
|
639
|
+
int status;
|
640
|
+
int mask = 0;
|
641
|
+
|
642
|
+
status = Tk_SetOptions(interp, recordPtr,
|
643
|
+
corePtr->optionTable, objc - 2, objv + 2,
|
644
|
+
corePtr->tkwin, &savedOptions, &mask);
|
645
|
+
if (status != TCL_OK)
|
646
|
+
return status;
|
647
|
+
|
648
|
+
if (mask & READONLY_OPTION) {
|
649
|
+
Tcl_SetResult(interp,
|
650
|
+
"Attempt to change read-only option", TCL_STATIC);
|
651
|
+
Tk_RestoreSavedOptions(&savedOptions);
|
652
|
+
return TCL_ERROR;
|
653
|
+
}
|
654
|
+
|
655
|
+
status = corePtr->widgetSpec->configureProc(interp, recordPtr, mask);
|
656
|
+
if (status != TCL_OK) {
|
657
|
+
Tk_RestoreSavedOptions(&savedOptions);
|
658
|
+
return status;
|
659
|
+
}
|
660
|
+
Tk_FreeSavedOptions(&savedOptions);
|
661
|
+
|
662
|
+
status = corePtr->widgetSpec->postConfigureProc(interp,recordPtr,mask);
|
663
|
+
if (status != TCL_OK) {
|
664
|
+
return status;
|
665
|
+
}
|
666
|
+
|
667
|
+
if (mask & (STYLE_CHANGED | GEOMETRY_CHANGED)) {
|
668
|
+
SizeChanged(corePtr);
|
669
|
+
}
|
670
|
+
|
671
|
+
TtkRedisplayWidget(corePtr);
|
672
|
+
result = Tcl_NewObj();
|
673
|
+
}
|
674
|
+
|
675
|
+
if (result == 0) {
|
676
|
+
return TCL_ERROR;
|
677
|
+
}
|
678
|
+
Tcl_SetObjResult(interp, result);
|
679
|
+
return TCL_OK;
|
680
|
+
}
|
681
|
+
|
682
|
+
/* $w state ? $stateSpec ?
|
683
|
+
*
|
684
|
+
* If $stateSpec is specified, modify the widget state accordingly,
|
685
|
+
* return a new stateSpec representing the changed bits.
|
686
|
+
*
|
687
|
+
* Otherwise, return a statespec matching all the currently-set bits.
|
688
|
+
*/
|
689
|
+
|
690
|
+
int TtkWidgetStateCommand(
|
691
|
+
Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
|
692
|
+
{
|
693
|
+
WidgetCore *corePtr = recordPtr;
|
694
|
+
Ttk_StateSpec spec;
|
695
|
+
int status;
|
696
|
+
Ttk_State oldState, changed;
|
697
|
+
|
698
|
+
if (objc == 2) {
|
699
|
+
Tcl_SetObjResult(interp,
|
700
|
+
Ttk_NewStateSpecObj(corePtr->state, 0ul));
|
701
|
+
return TCL_OK;
|
702
|
+
}
|
703
|
+
|
704
|
+
if (objc != 3) {
|
705
|
+
Tcl_WrongNumArgs(interp, 2, objv, "state-spec");
|
706
|
+
return TCL_ERROR;
|
707
|
+
}
|
708
|
+
status = Ttk_GetStateSpecFromObj(interp, objv[2], &spec);
|
709
|
+
if (status != TCL_OK)
|
710
|
+
return status;
|
711
|
+
|
712
|
+
oldState = corePtr->state;
|
713
|
+
corePtr->state = Ttk_ModifyState(corePtr->state, &spec);
|
714
|
+
changed = corePtr->state ^ oldState;
|
715
|
+
|
716
|
+
TtkRedisplayWidget(corePtr);
|
717
|
+
|
718
|
+
Tcl_SetObjResult(interp,
|
719
|
+
Ttk_NewStateSpecObj(oldState & changed, ~oldState & changed));
|
720
|
+
return status;
|
721
|
+
}
|
722
|
+
|
723
|
+
/* $w instate $stateSpec ?$script?
|
724
|
+
*
|
725
|
+
* Tests if widget state matches $stateSpec.
|
726
|
+
* If $script is specified, execute script if state matches.
|
727
|
+
* Otherwise, return true/false
|
728
|
+
*/
|
729
|
+
|
730
|
+
int TtkWidgetInstateCommand(
|
731
|
+
Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
|
732
|
+
{
|
733
|
+
WidgetCore *corePtr = recordPtr;
|
734
|
+
Ttk_State state = corePtr->state;
|
735
|
+
Ttk_StateSpec spec;
|
736
|
+
int status = TCL_OK;
|
737
|
+
|
738
|
+
if (objc < 3 || objc > 4) {
|
739
|
+
Tcl_WrongNumArgs(interp, 2, objv, "state-spec ?script?");
|
740
|
+
return TCL_ERROR;
|
741
|
+
}
|
742
|
+
status = Ttk_GetStateSpecFromObj(interp, objv[2], &spec);
|
743
|
+
if (status != TCL_OK)
|
744
|
+
return status;
|
745
|
+
|
746
|
+
if (objc == 3) {
|
747
|
+
Tcl_SetObjResult(interp,
|
748
|
+
Tcl_NewBooleanObj(Ttk_StateMatches(state,&spec)));
|
749
|
+
} else if (objc == 4) {
|
750
|
+
if (Ttk_StateMatches(state,&spec)) {
|
751
|
+
status = Tcl_EvalObjEx(interp, objv[3], 0);
|
752
|
+
}
|
753
|
+
}
|
754
|
+
return status;
|
755
|
+
}
|
756
|
+
|
757
|
+
/* $w identify $x $y
|
758
|
+
* Returns: name of element at $x, $y
|
759
|
+
*/
|
760
|
+
int TtkWidgetIdentifyCommand(
|
761
|
+
Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
|
762
|
+
{
|
763
|
+
WidgetCore *corePtr = recordPtr;
|
764
|
+
Ttk_LayoutNode *node;
|
765
|
+
int x, y;
|
766
|
+
|
767
|
+
if (objc != 4) {
|
768
|
+
Tcl_WrongNumArgs(interp, 2, objv, "x y");
|
769
|
+
return TCL_ERROR;
|
770
|
+
}
|
771
|
+
|
772
|
+
if (Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK
|
773
|
+
|| Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)
|
774
|
+
return TCL_ERROR;
|
775
|
+
|
776
|
+
node = Ttk_LayoutIdentify(corePtr->layout, x, y);
|
777
|
+
if (node) {
|
778
|
+
const char *elementName = Ttk_LayoutNodeName(node);
|
779
|
+
Tcl_SetObjResult(interp,Tcl_NewStringObj(elementName,-1));
|
780
|
+
}
|
781
|
+
|
782
|
+
return TCL_OK;
|
783
|
+
}
|
784
|
+
|
785
|
+
/*EOF*/
|