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,132 @@
|
|
|
1
|
+
/* separator.c,v 1.10 2007/10/25 06:42:47 jenglish Exp
|
|
2
|
+
*
|
|
3
|
+
* Copyright (c) 2004, Joe English
|
|
4
|
+
*
|
|
5
|
+
* ttk::separator and ttk::sizegrip widgets.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#include <tk.h>
|
|
9
|
+
|
|
10
|
+
#include "tkTheme.h"
|
|
11
|
+
#include "widget.h"
|
|
12
|
+
|
|
13
|
+
/* +++ Separator widget record:
|
|
14
|
+
*/
|
|
15
|
+
typedef struct
|
|
16
|
+
{
|
|
17
|
+
Tcl_Obj *orientObj;
|
|
18
|
+
int orient;
|
|
19
|
+
} SeparatorPart;
|
|
20
|
+
|
|
21
|
+
typedef struct
|
|
22
|
+
{
|
|
23
|
+
WidgetCore core;
|
|
24
|
+
SeparatorPart separator;
|
|
25
|
+
} Separator;
|
|
26
|
+
|
|
27
|
+
static Tk_OptionSpec SeparatorOptionSpecs[] =
|
|
28
|
+
{
|
|
29
|
+
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal",
|
|
30
|
+
Tk_Offset(Separator,separator.orientObj),
|
|
31
|
+
Tk_Offset(Separator,separator.orient),
|
|
32
|
+
0,(ClientData)ttkOrientStrings,STYLE_CHANGED },
|
|
33
|
+
|
|
34
|
+
WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/*
|
|
38
|
+
* GetLayout hook --
|
|
39
|
+
* Choose layout based on -orient option.
|
|
40
|
+
*/
|
|
41
|
+
static Ttk_Layout SeparatorGetLayout(
|
|
42
|
+
Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr)
|
|
43
|
+
{
|
|
44
|
+
Separator *sep = recordPtr;
|
|
45
|
+
return TtkWidgetGetOrientedLayout(
|
|
46
|
+
interp, theme, recordPtr, sep->separator.orientObj);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/*
|
|
50
|
+
* Widget commands:
|
|
51
|
+
*/
|
|
52
|
+
static WidgetCommandSpec SeparatorCommands[] =
|
|
53
|
+
{
|
|
54
|
+
{ "configure", TtkWidgetConfigureCommand },
|
|
55
|
+
{ "cget", TtkWidgetCgetCommand },
|
|
56
|
+
{ "identify", TtkWidgetIdentifyCommand },
|
|
57
|
+
{ "instate", TtkWidgetInstateCommand },
|
|
58
|
+
{ "state", TtkWidgetStateCommand },
|
|
59
|
+
{ NULL, NULL }
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
* Widget specification:
|
|
64
|
+
*/
|
|
65
|
+
static WidgetSpec SeparatorWidgetSpec =
|
|
66
|
+
{
|
|
67
|
+
"TSeparator", /* className */
|
|
68
|
+
sizeof(Separator), /* recordSize */
|
|
69
|
+
SeparatorOptionSpecs, /* optionSpecs */
|
|
70
|
+
SeparatorCommands, /* subcommands */
|
|
71
|
+
TtkNullInitialize, /* initializeProc */
|
|
72
|
+
TtkNullCleanup, /* cleanupProc */
|
|
73
|
+
TtkCoreConfigure, /* configureProc */
|
|
74
|
+
TtkNullPostConfigure, /* postConfigureProc */
|
|
75
|
+
SeparatorGetLayout, /* getLayoutProc */
|
|
76
|
+
TtkWidgetSize, /* sizeProc */
|
|
77
|
+
TtkWidgetDoLayout, /* layoutProc */
|
|
78
|
+
TtkWidgetDisplay /* displayProc */
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
TTK_BEGIN_LAYOUT(SeparatorLayout)
|
|
82
|
+
TTK_NODE("Separator.separator", TTK_FILL_BOTH)
|
|
83
|
+
TTK_END_LAYOUT
|
|
84
|
+
|
|
85
|
+
/* +++ Sizegrip widget:
|
|
86
|
+
* Has no options or methods other than the standard ones.
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
static WidgetCommandSpec SizegripCommands[] =
|
|
90
|
+
{
|
|
91
|
+
{ "configure", TtkWidgetConfigureCommand },
|
|
92
|
+
{ "cget", TtkWidgetCgetCommand },
|
|
93
|
+
{ "identify", TtkWidgetIdentifyCommand },
|
|
94
|
+
{ "instate", TtkWidgetInstateCommand },
|
|
95
|
+
{ "state", TtkWidgetStateCommand },
|
|
96
|
+
{ NULL, NULL }
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
static WidgetSpec SizegripWidgetSpec =
|
|
100
|
+
{
|
|
101
|
+
"TSizegrip", /* className */
|
|
102
|
+
sizeof(WidgetCore), /* recordSize */
|
|
103
|
+
ttkCoreOptionSpecs, /* optionSpecs */
|
|
104
|
+
SizegripCommands, /* subcommands */
|
|
105
|
+
TtkNullInitialize, /* initializeProc */
|
|
106
|
+
TtkNullCleanup, /* cleanupProc */
|
|
107
|
+
TtkCoreConfigure, /* configureProc */
|
|
108
|
+
TtkNullPostConfigure, /* postConfigureProc */
|
|
109
|
+
TtkWidgetGetLayout, /* getLayoutProc */
|
|
110
|
+
TtkWidgetSize, /* sizeProc */
|
|
111
|
+
TtkWidgetDoLayout, /* layoutProc */
|
|
112
|
+
TtkWidgetDisplay /* displayProc */
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
TTK_BEGIN_LAYOUT(SizegripLayout)
|
|
116
|
+
TTK_NODE("Sizegrip.sizegrip", TTK_PACK_BOTTOM|TTK_STICK_S|TTK_STICK_E)
|
|
117
|
+
TTK_END_LAYOUT
|
|
118
|
+
|
|
119
|
+
/* +++ Initialization:
|
|
120
|
+
*/
|
|
121
|
+
void TtkSeparator_Init(Tcl_Interp *interp)
|
|
122
|
+
{
|
|
123
|
+
Ttk_Theme theme = Ttk_GetDefaultTheme(interp);
|
|
124
|
+
|
|
125
|
+
Ttk_RegisterLayout(theme, "TSeparator", SeparatorLayout);
|
|
126
|
+
Ttk_RegisterLayout(theme, "TSizegrip", SizegripLayout);
|
|
127
|
+
|
|
128
|
+
RegisterWidget(interp, "ttk::separator", &SeparatorWidgetSpec);
|
|
129
|
+
RegisterWidget(interp, "ttk::sizegrip", &SizegripWidgetSpec);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/*EOF*/
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/* square.c - Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
|
|
2
|
+
*
|
|
3
|
+
* Minimal sample tile widget.
|
|
4
|
+
*
|
|
5
|
+
* square.c,v 1.8 2007/10/25 06:42:47 jenglish Exp
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#include <tk.h>
|
|
9
|
+
#include "tkTheme.h"
|
|
10
|
+
#include "widget.h"
|
|
11
|
+
|
|
12
|
+
#ifdef TTK_SQUARE_WIDGET
|
|
13
|
+
|
|
14
|
+
#ifndef DEFAULT_BORDERWIDTH
|
|
15
|
+
#define DEFAULT_BORDERWIDTH "2"
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
/*
|
|
19
|
+
* First, we setup the widget record. The Tile package provides a structure
|
|
20
|
+
* that contains standard widget data so it is only necessary to define
|
|
21
|
+
* a structure that holds the data required for our widget. We do this by
|
|
22
|
+
* defining a widget part and then specifying the widget record as the
|
|
23
|
+
* concatenation of the two structures.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
typedef struct
|
|
27
|
+
{
|
|
28
|
+
Tcl_Obj *widthObj;
|
|
29
|
+
Tcl_Obj *heightObj;
|
|
30
|
+
Tcl_Obj *reliefObj;
|
|
31
|
+
Tcl_Obj *borderWidthObj;
|
|
32
|
+
Tcl_Obj *foregroundObj;
|
|
33
|
+
Tcl_Obj *paddingObj;
|
|
34
|
+
Tcl_Obj *anchorObj;
|
|
35
|
+
} SquarePart;
|
|
36
|
+
|
|
37
|
+
typedef struct
|
|
38
|
+
{
|
|
39
|
+
WidgetCore core;
|
|
40
|
+
SquarePart square;
|
|
41
|
+
} Square;
|
|
42
|
+
|
|
43
|
+
/*
|
|
44
|
+
* Widget options.
|
|
45
|
+
*
|
|
46
|
+
* This structure is the same as the option specification structure used
|
|
47
|
+
* for Tk widgets. For each option we provide the type, name and options
|
|
48
|
+
* database name and class name and the position in the structure and
|
|
49
|
+
* default values. At the bottom we bring in the standard widget option
|
|
50
|
+
* defined for all widgets.
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
static Tk_OptionSpec SquareOptionSpecs[] =
|
|
54
|
+
{
|
|
55
|
+
WIDGET_TAKES_FOCUS,
|
|
56
|
+
|
|
57
|
+
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
|
|
58
|
+
DEFAULT_BORDERWIDTH, Tk_Offset(Square,square.borderWidthObj), -1,
|
|
59
|
+
0,0,GEOMETRY_CHANGED },
|
|
60
|
+
{TK_OPTION_BORDER, "-foreground", "foreground", "Foreground",
|
|
61
|
+
DEFAULT_BACKGROUND, Tk_Offset(Square,square.foregroundObj),
|
|
62
|
+
-1, 0, 0, 0},
|
|
63
|
+
|
|
64
|
+
{TK_OPTION_PIXELS, "-width", "width", "Width",
|
|
65
|
+
"50", Tk_Offset(Square,square.widthObj), -1, 0, 0,
|
|
66
|
+
GEOMETRY_CHANGED},
|
|
67
|
+
{TK_OPTION_PIXELS, "-height", "height", "Height",
|
|
68
|
+
"50", Tk_Offset(Square,square.heightObj), -1, 0, 0,
|
|
69
|
+
GEOMETRY_CHANGED},
|
|
70
|
+
|
|
71
|
+
{TK_OPTION_STRING, "-padding", "padding", "Pad", NULL,
|
|
72
|
+
Tk_Offset(Square,square.paddingObj), -1,
|
|
73
|
+
TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
|
|
74
|
+
|
|
75
|
+
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
|
|
76
|
+
NULL, Tk_Offset(Square,square.reliefObj), -1, TK_OPTION_NULL_OK, 0, 0},
|
|
77
|
+
|
|
78
|
+
{TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor",
|
|
79
|
+
NULL, Tk_Offset(Square,square.anchorObj), -1, TK_OPTION_NULL_OK, 0, 0},
|
|
80
|
+
|
|
81
|
+
WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/*
|
|
85
|
+
* Almost all of the widget functionality is handled by the default Tile
|
|
86
|
+
* widget code and the contained element. The one thing that we must handle
|
|
87
|
+
* is the -anchor option which positions the square element within the parcel
|
|
88
|
+
* of space available for the widget.
|
|
89
|
+
* To do this we must find out the layout preferences for the square
|
|
90
|
+
* element and adjust its position within our region.
|
|
91
|
+
*
|
|
92
|
+
* Note that if we do not have a "square" elememt then just the default
|
|
93
|
+
* layout will be done. So if someone places a label element into the
|
|
94
|
+
* widget layout it will still be handled but the -anchor option will be
|
|
95
|
+
* passed onto the label element instead of handled here.
|
|
96
|
+
*/
|
|
97
|
+
|
|
98
|
+
static void
|
|
99
|
+
SquareDoLayout(void *clientData)
|
|
100
|
+
{
|
|
101
|
+
WidgetCore *corePtr = (WidgetCore *)clientData;
|
|
102
|
+
Ttk_Box winBox;
|
|
103
|
+
Ttk_LayoutNode *squareNode;
|
|
104
|
+
|
|
105
|
+
squareNode = Ttk_LayoutFindNode(corePtr->layout, "square");
|
|
106
|
+
winBox = Ttk_WinBox(corePtr->tkwin);
|
|
107
|
+
Ttk_PlaceLayout(corePtr->layout, corePtr->state, winBox);
|
|
108
|
+
|
|
109
|
+
/*
|
|
110
|
+
* Adjust the position of the square element within the widget according
|
|
111
|
+
* to the -anchor option.
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
if (squareNode) {
|
|
115
|
+
Square *squarePtr = clientData;
|
|
116
|
+
Tk_Anchor anchor = TK_ANCHOR_CENTER;
|
|
117
|
+
Ttk_Box b;
|
|
118
|
+
|
|
119
|
+
b = Ttk_LayoutNodeParcel(squareNode);
|
|
120
|
+
if (squarePtr->square.anchorObj != NULL)
|
|
121
|
+
Tk_GetAnchorFromObj(NULL, squarePtr->square.anchorObj, &anchor);
|
|
122
|
+
b = Ttk_AnchorBox(winBox, b.width, b.height, anchor);
|
|
123
|
+
|
|
124
|
+
Ttk_PlaceLayoutNode(corePtr->layout, squareNode, b);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/*
|
|
129
|
+
* Widget commands. A widget is impelemented as an ensemble and the
|
|
130
|
+
* subcommands are listed here. Tile provides default implementations
|
|
131
|
+
* that are sufficient for our needs.
|
|
132
|
+
*/
|
|
133
|
+
|
|
134
|
+
static WidgetCommandSpec SquareCommands[] =
|
|
135
|
+
{
|
|
136
|
+
{ "configure", TtkWidgetConfigureCommand },
|
|
137
|
+
{ "cget", TtkWidgetCgetCommand },
|
|
138
|
+
{ "identify", TtkWidgetIdentifyCommand },
|
|
139
|
+
{ "instate", TtkWidgetInstateCommand },
|
|
140
|
+
{ "state", TtkWidgetStateCommand },
|
|
141
|
+
{ NULL, NULL }
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/*
|
|
145
|
+
* The Widget specification structure holds all the implementation
|
|
146
|
+
* information about this widget and this is what must be registered
|
|
147
|
+
* with Tk in the package initialization code (see bottom).
|
|
148
|
+
*/
|
|
149
|
+
|
|
150
|
+
static WidgetSpec SquareWidgetSpec =
|
|
151
|
+
{
|
|
152
|
+
"TSquare", /* className */
|
|
153
|
+
sizeof(Square), /* recordSize */
|
|
154
|
+
SquareOptionSpecs, /* optionSpecs */
|
|
155
|
+
SquareCommands, /* subcommands */
|
|
156
|
+
TtkNullInitialize, /* initializeProc */
|
|
157
|
+
TtkNullCleanup, /* cleanupProc */
|
|
158
|
+
TtkCoreConfigure, /* configureProc */
|
|
159
|
+
TtkNullPostConfigure, /* postConfigureProc */
|
|
160
|
+
TtkWidgetGetLayout, /* getLayoutProc */
|
|
161
|
+
TtkWidgetSize, /* sizeProc */
|
|
162
|
+
SquareDoLayout, /* layoutProc */
|
|
163
|
+
TtkWidgetDisplay /* displayProc */
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
/* ----------------------------------------------------------------------
|
|
167
|
+
* Square element
|
|
168
|
+
*
|
|
169
|
+
* In this section we demonstrate what is required to create a new themed
|
|
170
|
+
* element.
|
|
171
|
+
*/
|
|
172
|
+
|
|
173
|
+
typedef struct
|
|
174
|
+
{
|
|
175
|
+
Tcl_Obj *borderObj;
|
|
176
|
+
Tcl_Obj *foregroundObj;
|
|
177
|
+
Tcl_Obj *borderWidthObj;
|
|
178
|
+
Tcl_Obj *reliefObj;
|
|
179
|
+
Tcl_Obj *widthObj;
|
|
180
|
+
Tcl_Obj *heightObj;
|
|
181
|
+
} SquareElement;
|
|
182
|
+
|
|
183
|
+
static Ttk_ElementOptionSpec SquareElementOptions[] =
|
|
184
|
+
{
|
|
185
|
+
{ "-background", TK_OPTION_BORDER, Tk_Offset(SquareElement,borderObj),
|
|
186
|
+
DEFAULT_BACKGROUND },
|
|
187
|
+
{ "-foreground", TK_OPTION_BORDER, Tk_Offset(SquareElement,foregroundObj),
|
|
188
|
+
DEFAULT_BACKGROUND },
|
|
189
|
+
{ "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(SquareElement,borderWidthObj),
|
|
190
|
+
DEFAULT_BORDERWIDTH },
|
|
191
|
+
{ "-relief", TK_OPTION_RELIEF, Tk_Offset(SquareElement,reliefObj),
|
|
192
|
+
"raised" },
|
|
193
|
+
{ "-width", TK_OPTION_PIXELS, Tk_Offset(SquareElement,widthObj), "20"},
|
|
194
|
+
{ "-height", TK_OPTION_PIXELS, Tk_Offset(SquareElement,heightObj), "20"},
|
|
195
|
+
{ NULL }
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
/*
|
|
199
|
+
* The element geometry function is called when the layout code wishes to
|
|
200
|
+
* find out how big this element wants to be. We must return our preferred
|
|
201
|
+
* size and padding information
|
|
202
|
+
*/
|
|
203
|
+
|
|
204
|
+
static void SquareElementSize(
|
|
205
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
|
206
|
+
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
|
|
207
|
+
{
|
|
208
|
+
SquareElement *square = elementRecord;
|
|
209
|
+
int borderWidth = 0;
|
|
210
|
+
|
|
211
|
+
Tcl_GetIntFromObj(NULL, square->borderWidthObj, &borderWidth);
|
|
212
|
+
*paddingPtr = Ttk_UniformPadding((short)borderWidth);
|
|
213
|
+
Tk_GetPixelsFromObj(NULL, tkwin, square->widthObj, widthPtr);
|
|
214
|
+
Tk_GetPixelsFromObj(NULL, tkwin, square->heightObj, heightPtr);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/*
|
|
218
|
+
* Draw the element in the box provided.
|
|
219
|
+
*/
|
|
220
|
+
|
|
221
|
+
static void SquareElementDraw(
|
|
222
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
|
223
|
+
Drawable d, Ttk_Box b, unsigned int state)
|
|
224
|
+
{
|
|
225
|
+
SquareElement *square = elementRecord;
|
|
226
|
+
Tk_3DBorder border = NULL, foreground = NULL;
|
|
227
|
+
int borderWidth = 1, relief = TK_RELIEF_FLAT;
|
|
228
|
+
|
|
229
|
+
border = Tk_Get3DBorderFromObj(tkwin, square->borderObj);
|
|
230
|
+
foreground = Tk_Get3DBorderFromObj(tkwin, square->foregroundObj);
|
|
231
|
+
Tcl_GetIntFromObj(NULL, square->borderWidthObj, &borderWidth);
|
|
232
|
+
Tk_GetReliefFromObj(NULL, square->reliefObj, &relief);
|
|
233
|
+
|
|
234
|
+
Tk_Fill3DRectangle(tkwin, d, foreground,
|
|
235
|
+
b.x, b.y, b.width, b.height, borderWidth, relief);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
static Ttk_ElementSpec SquareElementSpec =
|
|
239
|
+
{
|
|
240
|
+
TK_STYLE_VERSION_2,
|
|
241
|
+
sizeof(SquareElement),
|
|
242
|
+
SquareElementOptions,
|
|
243
|
+
SquareElementSize,
|
|
244
|
+
SquareElementDraw
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
/* ----------------------------------------------------------------------
|
|
248
|
+
*
|
|
249
|
+
* Layout section.
|
|
250
|
+
*
|
|
251
|
+
* Every widget class needs a layout style that specifies which elements
|
|
252
|
+
* are part of the widget and how they should be placed. The element layout
|
|
253
|
+
* engine is similar to the Tk pack geometry manager. Read the documentation
|
|
254
|
+
* for the details. In this example we just need to have the square element
|
|
255
|
+
* that has been defined for this widget placed on a background. We will
|
|
256
|
+
* also need some padding to keep it away from the edges.
|
|
257
|
+
*/
|
|
258
|
+
|
|
259
|
+
TTK_BEGIN_LAYOUT(SquareLayout)
|
|
260
|
+
TTK_NODE("Square.background", TTK_FILL_BOTH)
|
|
261
|
+
TTK_GROUP("Square.padding", TTK_FILL_BOTH,
|
|
262
|
+
TTK_NODE("Square.square", 0))
|
|
263
|
+
TTK_END_LAYOUT
|
|
264
|
+
|
|
265
|
+
/* ----------------------------------------------------------------------
|
|
266
|
+
*
|
|
267
|
+
* Widget initialization.
|
|
268
|
+
*
|
|
269
|
+
* This file defines a new element and a new widget. We need to register
|
|
270
|
+
* the element with the themes that will need it. In this case we will
|
|
271
|
+
* register with the default theme that is the root of the theme inheritance
|
|
272
|
+
* tree. This means all themes will find this element.
|
|
273
|
+
* We then need to register the widget class style. This is the layout
|
|
274
|
+
* specification. If a different theme requires an alternative layout, we
|
|
275
|
+
* could register that here. For instance, in some themes the scrollbars have
|
|
276
|
+
* one uparrow, in other themes there are two uparrow elements.
|
|
277
|
+
* Finally we register the widget itself. This step creates a tcl command so
|
|
278
|
+
* that we can actually create an instance of this class. The widget is
|
|
279
|
+
* linked to a particular style by the widget class name. This is important
|
|
280
|
+
* to realise as the programmer may change the classname when creating a
|
|
281
|
+
* new instance. If this is done, a new layout will need to be created (which
|
|
282
|
+
* can be done at script level). Some widgets may require particular elements
|
|
283
|
+
* to be present but we try to avoid this where possible. In this widget's C
|
|
284
|
+
* code, no reference is made to any particular elements. The programmer is
|
|
285
|
+
* free to specify a new style using completely different elements.
|
|
286
|
+
*/
|
|
287
|
+
|
|
288
|
+
/* public */ int
|
|
289
|
+
TtkSquareWidget_Init(Tcl_Interp *interp)
|
|
290
|
+
{
|
|
291
|
+
Ttk_Theme theme = Ttk_GetDefaultTheme(interp);
|
|
292
|
+
|
|
293
|
+
/* register the new elements for this theme engine */
|
|
294
|
+
Ttk_RegisterElement(interp, theme, "square", &SquareElementSpec, NULL);
|
|
295
|
+
|
|
296
|
+
/* register the layout for this theme */
|
|
297
|
+
Ttk_RegisterLayout(theme, "TSquare", SquareLayout);
|
|
298
|
+
|
|
299
|
+
/* register the widget */
|
|
300
|
+
RegisterWidget(interp, "ttk::square", &SquareWidgetSpec);
|
|
301
|
+
|
|
302
|
+
return TCL_OK;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
#endif /* TTK_SQUARE_WIDGET */
|
|
306
|
+
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/* tagset.c,v 1.1 2006/09/21 18:22:33 jenglish Exp
|
|
2
|
+
*
|
|
3
|
+
* Tile widget set: tag tables. Half-baked, work in progress.
|
|
4
|
+
*
|
|
5
|
+
* Copyright (C) 2005, Joe English. Freely redistributable.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#include <string.h> /* for memset() */
|
|
9
|
+
#include <tcl.h>
|
|
10
|
+
#include <tk.h>
|
|
11
|
+
|
|
12
|
+
#include "tkTheme.h"
|
|
13
|
+
#include "widget.h"
|
|
14
|
+
|
|
15
|
+
/*------------------------------------------------------------------------
|
|
16
|
+
* +++ Internal data structures.
|
|
17
|
+
*/
|
|
18
|
+
struct TtkTag {
|
|
19
|
+
Tcl_Obj **tagRecord; /* ... hrmph. */
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
struct TtkTagTable {
|
|
23
|
+
Tk_OptionTable tagOptionTable; /* ... */
|
|
24
|
+
int tagRecordSize; /* size of tag record */
|
|
25
|
+
Tcl_HashTable tags; /* defined tags */
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/*------------------------------------------------------------------------
|
|
29
|
+
* +++ Tags.
|
|
30
|
+
*/
|
|
31
|
+
static Ttk_Tag NewTag(Ttk_TagTable tagTable)
|
|
32
|
+
{
|
|
33
|
+
Ttk_Tag tag = (Ttk_Tag)ckalloc(sizeof(*tag));
|
|
34
|
+
tag->tagRecord = (Tcl_Obj **)ckalloc(tagTable->tagRecordSize);
|
|
35
|
+
memset(tag->tagRecord, 0, tagTable->tagRecordSize);
|
|
36
|
+
return tag;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static void DeleteTag(Ttk_Tag tag, int nOptions)
|
|
40
|
+
{
|
|
41
|
+
int i;
|
|
42
|
+
for (i = 0; i < nOptions; ++i) {
|
|
43
|
+
if (tag->tagRecord[i]) {
|
|
44
|
+
Tcl_DecrRefCount(tag->tagRecord[i]);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
ckfree((void*)tag->tagRecord);
|
|
48
|
+
ckfree((void*)tag);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
Tcl_Obj **Ttk_TagRecord(Ttk_Tag tag)
|
|
52
|
+
{
|
|
53
|
+
return tag->tagRecord;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/*------------------------------------------------------------------------
|
|
57
|
+
* +++ Tag tables.
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
Ttk_TagTable Ttk_CreateTagTable(
|
|
61
|
+
Tk_OptionTable tagOptionTable, int tagRecordSize)
|
|
62
|
+
{
|
|
63
|
+
Ttk_TagTable tagTable = (Ttk_TagTable)ckalloc(sizeof(*tagTable));
|
|
64
|
+
tagTable->tagOptionTable = tagOptionTable;
|
|
65
|
+
tagTable->tagRecordSize = tagRecordSize;
|
|
66
|
+
Tcl_InitHashTable(&tagTable->tags, TCL_STRING_KEYS);
|
|
67
|
+
return tagTable;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
void Ttk_DeleteTagTable(Ttk_TagTable tagTable)
|
|
71
|
+
{
|
|
72
|
+
Tcl_HashSearch search;
|
|
73
|
+
Tcl_HashEntry *entryPtr;
|
|
74
|
+
int nOptions = tagTable->tagRecordSize / sizeof(Tcl_Obj *);
|
|
75
|
+
|
|
76
|
+
entryPtr = Tcl_FirstHashEntry(&tagTable->tags, &search);
|
|
77
|
+
while (entryPtr != NULL) {
|
|
78
|
+
DeleteTag(Tcl_GetHashValue(entryPtr), nOptions);
|
|
79
|
+
entryPtr = Tcl_NextHashEntry(&search);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
Tcl_DeleteHashTable(&tagTable->tags);
|
|
83
|
+
ckfree((void*)tagTable);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
Ttk_Tag Ttk_GetTag(Ttk_TagTable tagTable, const char *tagName)
|
|
87
|
+
{
|
|
88
|
+
int isNew = 0;
|
|
89
|
+
Tcl_HashEntry *entryPtr = Tcl_CreateHashEntry(
|
|
90
|
+
&tagTable->tags, tagName, &isNew);
|
|
91
|
+
|
|
92
|
+
if (isNew) {
|
|
93
|
+
Tcl_SetHashValue(entryPtr, NewTag(tagTable));
|
|
94
|
+
}
|
|
95
|
+
return Tcl_GetHashValue(entryPtr);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
Ttk_Tag Ttk_GetTagFromObj(Ttk_TagTable tagTable, Tcl_Obj *objPtr)
|
|
99
|
+
{
|
|
100
|
+
return Ttk_GetTag(tagTable, Tcl_GetString(objPtr));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Ttk_GetTagListFromObj --
|
|
104
|
+
* Extract an array of pointers to Ttk_Tags from a Tcl_Obj.
|
|
105
|
+
* (suitable for passing to Tk_BindEvent).
|
|
106
|
+
*
|
|
107
|
+
* Result must be passed to Ttk_FreeTagList().
|
|
108
|
+
*/
|
|
109
|
+
extern int Ttk_GetTagListFromObj(
|
|
110
|
+
Tcl_Interp *interp,
|
|
111
|
+
Ttk_TagTable tagTable,
|
|
112
|
+
Tcl_Obj *objPtr,
|
|
113
|
+
int *nTags_rtn,
|
|
114
|
+
void **taglist_rtn)
|
|
115
|
+
{
|
|
116
|
+
Tcl_Obj **objv;
|
|
117
|
+
int i, objc;
|
|
118
|
+
void **tags;
|
|
119
|
+
|
|
120
|
+
*taglist_rtn = NULL; *nTags_rtn = 0;
|
|
121
|
+
|
|
122
|
+
if (objPtr == NULL) {
|
|
123
|
+
return TCL_OK;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) {
|
|
127
|
+
return TCL_ERROR;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
tags = (void**)ckalloc((objc+1) * sizeof(void*));
|
|
131
|
+
for (i=0; i<objc; ++i) {
|
|
132
|
+
tags[i] = Ttk_GetTagFromObj(tagTable, objv[i]);
|
|
133
|
+
}
|
|
134
|
+
tags[i] = NULL;
|
|
135
|
+
|
|
136
|
+
*taglist_rtn = tags;
|
|
137
|
+
*nTags_rtn = objc;
|
|
138
|
+
|
|
139
|
+
return TCL_OK;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
void Ttk_FreeTagList(void **taglist)
|
|
143
|
+
{
|
|
144
|
+
if (taglist)
|
|
145
|
+
ckfree((ClientData)taglist);
|
|
146
|
+
}
|
|
147
|
+
|