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,77 @@
|
|
1
|
+
#
|
2
|
+
# winTheme.tcl,v 1.39 2007/11/18 18:09:26 jenglish Exp
|
3
|
+
#
|
4
|
+
# Settings for 'winnative' theme.
|
5
|
+
#
|
6
|
+
|
7
|
+
namespace eval ttk::theme::winnative {
|
8
|
+
ttk::style theme settings winnative {
|
9
|
+
|
10
|
+
ttk::style configure "." \
|
11
|
+
-background SystemButtonFace \
|
12
|
+
-foreground SystemWindowText \
|
13
|
+
-selectforeground SystemHighlightText \
|
14
|
+
-selectbackground SystemHighlight \
|
15
|
+
-troughcolor SystemScrollbar \
|
16
|
+
-font TkDefaultFont \
|
17
|
+
;
|
18
|
+
|
19
|
+
ttk::style map "." -foreground [list disabled SystemGrayText] ;
|
20
|
+
ttk::style map "." -embossed [list disabled 1] ;
|
21
|
+
|
22
|
+
ttk::style configure TButton \
|
23
|
+
-anchor center -width -11 -relief raised -shiftrelief 1
|
24
|
+
ttk::style configure TCheckbutton -padding "2 4"
|
25
|
+
ttk::style configure TRadiobutton -padding "2 4"
|
26
|
+
ttk::style configure TMenubutton \
|
27
|
+
-padding "8 4" -arrowsize 3 -relief raised
|
28
|
+
|
29
|
+
ttk::style map TButton -relief {{!disabled pressed} sunken}
|
30
|
+
|
31
|
+
ttk::style configure TEntry \
|
32
|
+
-padding 2 -selectborderwidth 0 -insertwidth 1
|
33
|
+
ttk::style map TEntry \
|
34
|
+
-fieldbackground \
|
35
|
+
[list readonly SystemButtonFace disabled SystemButtonFace] \
|
36
|
+
-selectbackground [list !focus SystemWindow] \
|
37
|
+
-selectforeground [list !focus SystemWindowText] \
|
38
|
+
;
|
39
|
+
|
40
|
+
ttk::style configure TCombobox -padding 2
|
41
|
+
ttk::style map TCombobox \
|
42
|
+
-selectbackground [list !focus SystemWindow] \
|
43
|
+
-selectforeground [list !focus SystemWindowText] \
|
44
|
+
-foreground [list {readonly focus} SystemHighlightText] \
|
45
|
+
-focusfill [list {readonly focus} SystemHighlight] \
|
46
|
+
;
|
47
|
+
|
48
|
+
ttk::style configure TLabelframe -borderwidth 2 -relief groove
|
49
|
+
|
50
|
+
ttk::style configure Toolbutton -relief flat -padding {8 4}
|
51
|
+
ttk::style map Toolbutton -relief \
|
52
|
+
{disabled flat selected sunken pressed sunken active raised}
|
53
|
+
|
54
|
+
ttk::style configure TScale -groovewidth 4
|
55
|
+
|
56
|
+
ttk::style configure TNotebook -tabmargins {2 2 2 0}
|
57
|
+
ttk::style configure TNotebook.Tab -padding {3 1} -borderwidth 1
|
58
|
+
ttk::style map TNotebook.Tab -expand [list selected {2 2 2 0}]
|
59
|
+
|
60
|
+
# Treeview:
|
61
|
+
ttk::style configure Heading -font TkHeadingFont -relief raised
|
62
|
+
ttk::style configure Row -background SystemWindow
|
63
|
+
ttk::style configure Cell -background SystemWindow
|
64
|
+
ttk::style map Row \
|
65
|
+
-background [list selected SystemHighlight] \
|
66
|
+
-foreground [list selected SystemHighlightText] ;
|
67
|
+
ttk::style map Cell \
|
68
|
+
-background [list selected SystemHighlight] \
|
69
|
+
-foreground [list selected SystemHighlightText] ;
|
70
|
+
ttk::style map Item \
|
71
|
+
-background [list selected SystemHighlight] \
|
72
|
+
-foreground [list selected SystemHighlightText] ;
|
73
|
+
|
74
|
+
ttk::style configure TProgressbar \
|
75
|
+
-background SystemHighlight -borderwidth 0 ;
|
76
|
+
}
|
77
|
+
}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
#
|
2
|
+
# xpTheme.tcl,v 1.39 2007/11/18 18:09:26 jenglish Exp
|
3
|
+
#
|
4
|
+
# Settings for 'xpnative' theme
|
5
|
+
#
|
6
|
+
|
7
|
+
namespace eval ttk::theme::xpnative {
|
8
|
+
ttk::style theme settings xpnative {
|
9
|
+
|
10
|
+
ttk::style configure . \
|
11
|
+
-background SystemButtonFace \
|
12
|
+
-foreground SystemWindowText \
|
13
|
+
-selectforeground SystemHighlightText \
|
14
|
+
-selectbackground SystemHighlight \
|
15
|
+
-font TkDefaultFont \
|
16
|
+
;
|
17
|
+
|
18
|
+
ttk::style map "." \
|
19
|
+
-foreground [list disabled SystemGrayText] \
|
20
|
+
;
|
21
|
+
|
22
|
+
ttk::style configure TButton -anchor center -padding {1 1} -width -11
|
23
|
+
ttk::style configure TRadiobutton -padding 2
|
24
|
+
ttk::style configure TCheckbutton -padding 2
|
25
|
+
ttk::style configure TMenubutton -padding {8 4}
|
26
|
+
|
27
|
+
ttk::style configure TNotebook -tabmargins {2 2 2 0}
|
28
|
+
ttk::style map TNotebook.Tab \
|
29
|
+
-expand [list selected {2 2 2 2}]
|
30
|
+
|
31
|
+
# Treeview:
|
32
|
+
ttk::style configure Heading -font TkHeadingFont
|
33
|
+
ttk::style configure Row -background SystemWindow
|
34
|
+
ttk::style configure Cell -background SystemWindow
|
35
|
+
ttk::style map Row \
|
36
|
+
-background [list selected SystemHighlight] \
|
37
|
+
-foreground [list selected SystemHighlightText] ;
|
38
|
+
ttk::style map Cell \
|
39
|
+
-background [list selected SystemHighlight] \
|
40
|
+
-foreground [list selected SystemHighlightText] ;
|
41
|
+
ttk::style map Item \
|
42
|
+
-background [list selected SystemHighlight] \
|
43
|
+
-foreground [list selected SystemHighlightText] ;
|
44
|
+
|
45
|
+
ttk::style configure TLabelframe -foreground "#0046d5"
|
46
|
+
|
47
|
+
# OR: -padding {3 3 3 6}, which some apps seem to use.
|
48
|
+
ttk::style configure TEntry -padding {2 2 2 4}
|
49
|
+
ttk::style map TEntry \
|
50
|
+
-selectbackground [list !focus SystemWindow] \
|
51
|
+
-selectforeground [list !focus SystemWindowText] \
|
52
|
+
;
|
53
|
+
ttk::style configure TCombobox -padding 2
|
54
|
+
ttk::style map TCombobox \
|
55
|
+
-selectbackground [list !focus SystemWindow] \
|
56
|
+
-selectforeground [list !focus SystemWindowText] \
|
57
|
+
-foreground [list {readonly focus} SystemHighlightText] \
|
58
|
+
-focusfill [list {readonly focus} SystemHighlight] \
|
59
|
+
;
|
60
|
+
|
61
|
+
ttk::style configure Toolbutton -padding {4 4}
|
62
|
+
}
|
63
|
+
}
|
Binary file
|
Binary file
|
@@ -0,0 +1,24 @@
|
|
1
|
+
LICENSE ("MIT-style")
|
2
|
+
|
3
|
+
This software is Copyright (C) 2003 Joe English and other parties.
|
4
|
+
|
5
|
+
The following terms apply to all files associated with this software
|
6
|
+
unless explicitly disclaimed in individual files.
|
7
|
+
|
8
|
+
The author(s) hereby grant permission to use, copy, modify, distribute,
|
9
|
+
and license this software and its documentation for any purpose, provided
|
10
|
+
that existing copyright notices are retained in all copies and that this
|
11
|
+
notice is included in any distributions. No written agreement,
|
12
|
+
license, or royalty fee is required for any of the authorized uses.
|
13
|
+
Modifications to this software may be copyrighted by their authors
|
14
|
+
and need not follow the licensing terms described here, provided that
|
15
|
+
the new terms are clearly indicated on the first page of each file where
|
16
|
+
they apply.
|
17
|
+
|
18
|
+
This program is distributed in the hope that it will be useful,
|
19
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20
|
+
MERCHANTABILITY or FITNESS for a PARTICULAR PURPOSE. IN NO EVENT
|
21
|
+
shall the AUTHORS of THIS SOFTWARE be LIABLE to ANY PARTY for
|
22
|
+
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, or CONSEQUENTIAL DAMAGES
|
23
|
+
arising out of the USE of THIS SOFTWARE and its DOCUMENTATION.
|
24
|
+
|
@@ -0,0 +1,1076 @@
|
|
1
|
+
/*
|
2
|
+
* aquaTheme.c,v 1.49 2007/12/06 17:58:02 jenglish Exp
|
3
|
+
*
|
4
|
+
* Tk theme engine for Mac OSX, using the Appearance Manager API.
|
5
|
+
*
|
6
|
+
* Copyright (c) 2004 Joe English
|
7
|
+
* Copyright (c) 2005 Neil Madden
|
8
|
+
* Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
|
9
|
+
*
|
10
|
+
* See the file "license.terms" for information on usage and redistribution
|
11
|
+
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
12
|
+
*
|
13
|
+
* See also:
|
14
|
+
*
|
15
|
+
* <URL: http://developer.apple.com/documentation/Carbon/Reference/
|
16
|
+
* Appearance_Manager/appearance_manager/APIIndex.html >
|
17
|
+
*
|
18
|
+
* Notes:
|
19
|
+
* "Active" means different things in Mac and Tk terminology --
|
20
|
+
* On Aqua, widgets are "Active" if they belong to the foreground window,
|
21
|
+
* "Inactive" if they are in a background window.
|
22
|
+
* Tk uses the term "active" to mean that the mouse cursor
|
23
|
+
* is over a widget; aka "hover", "prelight", or "hot-tracked".
|
24
|
+
* Aqua doesn't use this kind of feedback.
|
25
|
+
*
|
26
|
+
* The QuickDraw/Carbon coordinate system is relative to the
|
27
|
+
* top-level window, not to the Tk_Window. BoxToRect()
|
28
|
+
* accounts for this.
|
29
|
+
*/
|
30
|
+
|
31
|
+
#include <Carbon/Carbon.h>
|
32
|
+
#include <tk.h>
|
33
|
+
#include <tkInt.h>
|
34
|
+
#include <tkMacOSX.h>
|
35
|
+
#include <tkMacOSXInt.h>
|
36
|
+
#include "tkTheme.h"
|
37
|
+
|
38
|
+
/* Define a constant that was renamed for Mac OS X 10.4 */
|
39
|
+
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1040
|
40
|
+
#define kThemeDisclosureTriangle kThemeDisclosureButton
|
41
|
+
#endif
|
42
|
+
|
43
|
+
#if !defined(BUILD_tile)
|
44
|
+
/*
|
45
|
+
* Use this version in the core:
|
46
|
+
*/
|
47
|
+
#define BEGIN_DRAWING(d) { \
|
48
|
+
TkMacOSXDrawingContext dc; \
|
49
|
+
if (!TkMacOSXSetupDrawingContext((d), NULL, 0, &dc)) {return;}
|
50
|
+
#define END_DRAWING \
|
51
|
+
TkMacOSXRestoreDrawingContext(&dc); }
|
52
|
+
#else /* BUILD_tile */
|
53
|
+
/*
|
54
|
+
* TkMacOSXSetupDrawingContext is not available to extensions,
|
55
|
+
* need to do this the hard way in Tile:
|
56
|
+
*/
|
57
|
+
#define BEGIN_DRAWING(d) { \
|
58
|
+
CGrafPtr saveWorld; GDHandle saveDevice; \
|
59
|
+
GetGWorld(&saveWorld, &saveDevice); \
|
60
|
+
SetGWorld(TkMacOSXGetDrawablePort(d), 0); \
|
61
|
+
TkMacOSXSetUpClippingRgn(d);
|
62
|
+
#define END_DRAWING \
|
63
|
+
SetGWorld(saveWorld,saveDevice); }
|
64
|
+
#endif /* defined(BUILD_TILE) */
|
65
|
+
|
66
|
+
/*----------------------------------------------------------------------
|
67
|
+
* +++ Utilities.
|
68
|
+
*/
|
69
|
+
|
70
|
+
/*
|
71
|
+
* BoxToRect --
|
72
|
+
* Convert a Ttk_Box in Tk coordinates relative to the given Drawable
|
73
|
+
* to a native Rect relative to the containing port.
|
74
|
+
*/
|
75
|
+
static inline Rect BoxToRect(Drawable d, Ttk_Box b)
|
76
|
+
{
|
77
|
+
MacDrawable *md = (MacDrawable*)d;
|
78
|
+
Rect rect;
|
79
|
+
|
80
|
+
rect.top = b.y + md->yOff;
|
81
|
+
rect.left = b.x + md->xOff;
|
82
|
+
rect.bottom = rect.top + b.height;
|
83
|
+
rect.right = rect.left + b.width;
|
84
|
+
|
85
|
+
return rect;
|
86
|
+
}
|
87
|
+
|
88
|
+
/*
|
89
|
+
* PatternOrigin --
|
90
|
+
* Compute brush pattern origin for a Drawable relative to a Tk_Window.
|
91
|
+
*
|
92
|
+
* Notes: This will only be nonzero if the Drawable is an off-screen pixmap.
|
93
|
+
* See also SF bug #1157739.
|
94
|
+
*/
|
95
|
+
static Point PatternOrigin(Tk_Window tkwin, Drawable d)
|
96
|
+
{
|
97
|
+
MacDrawable *md = (MacDrawable*)d;
|
98
|
+
Rect bounds;
|
99
|
+
Point origin;
|
100
|
+
|
101
|
+
TkMacOSXWinBounds((TkWindow *) tkwin, &bounds);
|
102
|
+
origin.h = md->xOff - bounds.left;
|
103
|
+
origin.v = md->yOff - bounds.top;
|
104
|
+
|
105
|
+
return origin;
|
106
|
+
}
|
107
|
+
|
108
|
+
/*
|
109
|
+
* DontErase --
|
110
|
+
* No-op ThemeEraseProc, can be passed to DrawThemeButton &c.
|
111
|
+
*/
|
112
|
+
static void DontErase(
|
113
|
+
const Rect *bounds, UInt32 eraseData, SInt16 depth, Boolean isColorDev)
|
114
|
+
{ }
|
115
|
+
|
116
|
+
/*
|
117
|
+
* Table mapping Tk states to Appearance manager ThemeStates
|
118
|
+
*/
|
119
|
+
|
120
|
+
static Ttk_StateTable ThemeStateTable[] = {
|
121
|
+
{kThemeStateUnavailable, TTK_STATE_DISABLED, 0},
|
122
|
+
{kThemeStatePressed, TTK_STATE_PRESSED, 0},
|
123
|
+
{kThemeStateInactive, TTK_STATE_BACKGROUND, 0},
|
124
|
+
{kThemeStateActive, 0, 0}
|
125
|
+
/* Others: Not sure what these are supposed to mean.
|
126
|
+
Up/Down have something to do with "little arrow" increment controls...
|
127
|
+
Dunno what a "Rollover" is.
|
128
|
+
NEM: Rollover is TTK_STATE_ACTIVE... but we don't handle that yet, by the
|
129
|
+
looks of things
|
130
|
+
{kThemeStateRollover, 0, 0},
|
131
|
+
{kThemeStateUnavailableInactive, 0, 0}
|
132
|
+
{kThemeStatePressedUp, 0, 0},
|
133
|
+
{kThemeStatePressedDown, 0, 0}
|
134
|
+
*/
|
135
|
+
};
|
136
|
+
|
137
|
+
/*----------------------------------------------------------------------
|
138
|
+
* +++ Button element: Used for elements drawn with DrawThemeButton.
|
139
|
+
*/
|
140
|
+
|
141
|
+
/*
|
142
|
+
* Extra margins to account for drop shadow.
|
143
|
+
*/
|
144
|
+
static Ttk_Padding ButtonMargins = {2,2,2,2};
|
145
|
+
|
146
|
+
#define NoThemeMetric 0xFFFFFFFF
|
147
|
+
|
148
|
+
typedef struct {
|
149
|
+
ThemeButtonKind kind;
|
150
|
+
ThemeMetric heightMetric;
|
151
|
+
} ThemeButtonParms;
|
152
|
+
|
153
|
+
static ThemeButtonParms
|
154
|
+
PushButtonParms = { kThemePushButton, kThemeMetricPushButtonHeight },
|
155
|
+
CheckBoxParms = { kThemeCheckBox, kThemeMetricCheckBoxHeight },
|
156
|
+
RadioButtonParms = { kThemeRadioButton, kThemeMetricRadioButtonHeight },
|
157
|
+
BevelButtonParms = { kThemeBevelButton, NoThemeMetric },
|
158
|
+
PopupButtonParms = { kThemePopupButton, kThemeMetricPopupButtonHeight },
|
159
|
+
DisclosureParms = { kThemeDisclosureButton, kThemeMetricDisclosureTriangleHeight },
|
160
|
+
ListHeaderParms = { kThemeListHeaderButton, kThemeMetricListHeaderHeight };
|
161
|
+
|
162
|
+
static Ttk_StateTable ButtonValueTable[] = {
|
163
|
+
{ kThemeButtonMixed, TTK_STATE_ALTERNATE, 0 },
|
164
|
+
{ kThemeButtonOn, TTK_STATE_SELECTED, 0 },
|
165
|
+
{ kThemeButtonOff, 0, 0 }
|
166
|
+
/* Others: kThemeDisclosureRight, kThemeDisclosureDown, kThemeDisclosureLeft */
|
167
|
+
};
|
168
|
+
|
169
|
+
static Ttk_StateTable ButtonAdornmentTable[] = {
|
170
|
+
{ kThemeAdornmentDefault, TTK_STATE_ALTERNATE, 0 },
|
171
|
+
{ kThemeAdornmentFocus, TTK_STATE_FOCUS, 0 },
|
172
|
+
{ kThemeAdornmentNone, 0, 0 }
|
173
|
+
};
|
174
|
+
|
175
|
+
/*
|
176
|
+
* computeButtonDrawInfo --
|
177
|
+
* Fill in an appearance manager ThemeButtonDrawInfo record.
|
178
|
+
*/
|
179
|
+
static ThemeButtonDrawInfo computeButtonDrawInfo(
|
180
|
+
ThemeButtonParms *parms, Ttk_State state)
|
181
|
+
{
|
182
|
+
ThemeButtonDrawInfo info;
|
183
|
+
|
184
|
+
info.state = Ttk_StateTableLookup(ThemeStateTable, state);
|
185
|
+
info.value = Ttk_StateTableLookup(ButtonValueTable, state);
|
186
|
+
info.adornment = Ttk_StateTableLookup(ButtonAdornmentTable, state);
|
187
|
+
return info;
|
188
|
+
}
|
189
|
+
|
190
|
+
static void ButtonElementSizeNoPadding(
|
191
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
192
|
+
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
|
193
|
+
{
|
194
|
+
ThemeButtonParms *parms = clientData;
|
195
|
+
|
196
|
+
if (parms->heightMetric != NoThemeMetric) {
|
197
|
+
SInt32 height;
|
198
|
+
|
199
|
+
GetThemeMetric(parms->heightMetric, &height);
|
200
|
+
*heightPtr = height;
|
201
|
+
}
|
202
|
+
}
|
203
|
+
|
204
|
+
static void ButtonElementSize(
|
205
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
206
|
+
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
|
207
|
+
{
|
208
|
+
ThemeButtonParms *parms = clientData;
|
209
|
+
ThemeButtonDrawInfo info = computeButtonDrawInfo(parms, 0);
|
210
|
+
static const Rect scratchBounds = {0, 0, 100, 100};
|
211
|
+
Rect contentBounds;
|
212
|
+
|
213
|
+
ButtonElementSizeNoPadding(
|
214
|
+
clientData, elementRecord, tkwin,
|
215
|
+
widthPtr, heightPtr, paddingPtr);
|
216
|
+
|
217
|
+
/*
|
218
|
+
* To compute internal padding, query the appearance manager
|
219
|
+
* for the content bounds of a dummy rectangle, then use
|
220
|
+
* the difference as the padding.
|
221
|
+
*/
|
222
|
+
GetThemeButtonContentBounds(
|
223
|
+
&scratchBounds, parms->kind, &info, &contentBounds);
|
224
|
+
|
225
|
+
paddingPtr->left = contentBounds.left;
|
226
|
+
paddingPtr->top = contentBounds.top;
|
227
|
+
paddingPtr->right = scratchBounds.right - contentBounds.right + 1;
|
228
|
+
paddingPtr->bottom = scratchBounds.bottom - contentBounds.bottom;
|
229
|
+
|
230
|
+
/*
|
231
|
+
* Now add a little extra padding to account for drop shadows.
|
232
|
+
* @@@ SHOULD: call GetThemeButtonBackgroundBounds() instead.
|
233
|
+
*/
|
234
|
+
|
235
|
+
*paddingPtr = Ttk_AddPadding(*paddingPtr, ButtonMargins);
|
236
|
+
*widthPtr += Ttk_PaddingWidth(ButtonMargins);
|
237
|
+
*heightPtr += Ttk_PaddingHeight(ButtonMargins);
|
238
|
+
}
|
239
|
+
|
240
|
+
static void ButtonElementDraw(
|
241
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
242
|
+
Drawable d, Ttk_Box b, Ttk_State state)
|
243
|
+
{
|
244
|
+
ThemeButtonParms *parms = clientData;
|
245
|
+
ThemeButtonDrawInfo info = computeButtonDrawInfo(parms, state);
|
246
|
+
Rect bounds = BoxToRect(d, Ttk_PadBox(b, ButtonMargins));
|
247
|
+
|
248
|
+
BEGIN_DRAWING(d)
|
249
|
+
DrawThemeButton(&bounds, parms->kind, &info, NULL, NULL, NULL, 0);
|
250
|
+
END_DRAWING
|
251
|
+
}
|
252
|
+
|
253
|
+
static Ttk_ElementSpec ButtonElementSpec = {
|
254
|
+
TK_STYLE_VERSION_2,
|
255
|
+
sizeof(NullElement),
|
256
|
+
TtkNullElementOptions,
|
257
|
+
ButtonElementSize,
|
258
|
+
ButtonElementDraw
|
259
|
+
};
|
260
|
+
|
261
|
+
/*----------------------------------------------------------------------
|
262
|
+
* +++ Notebook elements.
|
263
|
+
*/
|
264
|
+
|
265
|
+
static Ttk_StateTable TabStyleTable[] = {
|
266
|
+
{ kThemeTabFrontInactive, TTK_STATE_SELECTED|TTK_STATE_BACKGROUND, 0 },
|
267
|
+
{ kThemeTabNonFrontInactive, TTK_STATE_BACKGROUND, 0 },
|
268
|
+
{ kThemeTabFrontUnavailable, TTK_STATE_DISABLED|TTK_STATE_SELECTED, 0 },
|
269
|
+
{ kThemeTabNonFrontUnavailable, TTK_STATE_DISABLED, 0 },
|
270
|
+
{ kThemeTabFront, TTK_STATE_SELECTED, 0 },
|
271
|
+
{ kThemeTabNonFrontPressed, TTK_STATE_PRESSED, 0 },
|
272
|
+
{ kThemeTabNonFront, 0,0 }
|
273
|
+
};
|
274
|
+
|
275
|
+
/*
|
276
|
+
* Quoth DrawThemeTab() reference manual:
|
277
|
+
* "Small tabs have a height of 16 pixels large tabs have a height of
|
278
|
+
* 21 pixels. (The widths of tabs are variable.) Additionally, the
|
279
|
+
* distance that the tab overlaps the pane must be included in the tab
|
280
|
+
* rectangle this overlap distance is always 3 pixels, although the
|
281
|
+
* 3-pixel overlap is only drawn for the front tab."
|
282
|
+
*/
|
283
|
+
static const int TAB_HEIGHT = 21;
|
284
|
+
static const int TAB_OVERLAP = 3;
|
285
|
+
|
286
|
+
static void TabElementSize(
|
287
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
288
|
+
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
|
289
|
+
{
|
290
|
+
*heightPtr = TAB_HEIGHT + TAB_OVERLAP - 1;
|
291
|
+
}
|
292
|
+
|
293
|
+
static void TabElementDraw(
|
294
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
295
|
+
Drawable d, Ttk_Box b, Ttk_State state)
|
296
|
+
{
|
297
|
+
Rect bounds = BoxToRect(d, b);
|
298
|
+
ThemeTabStyle tabStyle = Ttk_StateTableLookup(TabStyleTable, state);
|
299
|
+
|
300
|
+
bounds.bottom += TAB_OVERLAP;
|
301
|
+
BEGIN_DRAWING(d)
|
302
|
+
DrawThemeTab(&bounds, tabStyle, kThemeTabNorth, 0, 0);
|
303
|
+
END_DRAWING
|
304
|
+
}
|
305
|
+
|
306
|
+
static Ttk_ElementSpec TabElementSpec = {
|
307
|
+
TK_STYLE_VERSION_2,
|
308
|
+
sizeof(NullElement),
|
309
|
+
TtkNullElementOptions,
|
310
|
+
TabElementSize,
|
311
|
+
TabElementDraw
|
312
|
+
};
|
313
|
+
|
314
|
+
/*
|
315
|
+
* Notebook panes:
|
316
|
+
*/
|
317
|
+
static void PaneElementSize(
|
318
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
319
|
+
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
|
320
|
+
{
|
321
|
+
/* Padding determined by trial-and-error */
|
322
|
+
*paddingPtr = Ttk_MakePadding(2,8,2,2);
|
323
|
+
}
|
324
|
+
|
325
|
+
static void PaneElementDraw(
|
326
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
327
|
+
Drawable d, Ttk_Box b, Ttk_State state)
|
328
|
+
{
|
329
|
+
Rect bounds = BoxToRect(d, b);
|
330
|
+
ThemeDrawState drawState = Ttk_StateTableLookup(ThemeStateTable, state);
|
331
|
+
|
332
|
+
BEGIN_DRAWING(d)
|
333
|
+
DrawThemeTabPane(&bounds, drawState);
|
334
|
+
END_DRAWING
|
335
|
+
}
|
336
|
+
|
337
|
+
static Ttk_ElementSpec PaneElementSpec = {
|
338
|
+
TK_STYLE_VERSION_2,
|
339
|
+
sizeof(NullElement),
|
340
|
+
TtkNullElementOptions,
|
341
|
+
PaneElementSize,
|
342
|
+
PaneElementDraw
|
343
|
+
};
|
344
|
+
|
345
|
+
/*
|
346
|
+
* Labelframe borders:
|
347
|
+
* Use "primary group box ..."
|
348
|
+
* Quoth DrawThemePrimaryGroup reference:
|
349
|
+
* "The primary group box frame is drawn inside the specified
|
350
|
+
* rectangle and is a maximum of 2 pixels thick."
|
351
|
+
*
|
352
|
+
* "Maximum of 2 pixels thick" is apparently a lie;
|
353
|
+
* looks more like 4 to me with shading.
|
354
|
+
*/
|
355
|
+
static void GroupElementSize(
|
356
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
357
|
+
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
|
358
|
+
{
|
359
|
+
*paddingPtr = Ttk_UniformPadding(4);
|
360
|
+
}
|
361
|
+
|
362
|
+
static void GroupElementDraw(
|
363
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
364
|
+
Drawable d, Ttk_Box b, Ttk_State state)
|
365
|
+
{
|
366
|
+
Rect bounds = BoxToRect(d, b);
|
367
|
+
ThemeDrawState drawState = Ttk_StateTableLookup(ThemeStateTable, state);
|
368
|
+
|
369
|
+
BEGIN_DRAWING(d)
|
370
|
+
DrawThemePrimaryGroup(&bounds, drawState);
|
371
|
+
END_DRAWING
|
372
|
+
}
|
373
|
+
|
374
|
+
static Ttk_ElementSpec GroupElementSpec = {
|
375
|
+
TK_STYLE_VERSION_2,
|
376
|
+
sizeof(NullElement),
|
377
|
+
TtkNullElementOptions,
|
378
|
+
GroupElementSize,
|
379
|
+
GroupElementDraw
|
380
|
+
};
|
381
|
+
|
382
|
+
/*----------------------------------------------------------------------
|
383
|
+
* +++ Entry element --
|
384
|
+
* 3 pixels padding for focus rectangle
|
385
|
+
* 2 pixels padding for EditTextFrame
|
386
|
+
*/
|
387
|
+
|
388
|
+
typedef struct {
|
389
|
+
Tcl_Obj *backgroundObj;
|
390
|
+
} EntryElement;
|
391
|
+
|
392
|
+
static Ttk_ElementOptionSpec EntryElementOptions[] = {
|
393
|
+
{ "-background", TK_OPTION_BORDER,
|
394
|
+
Tk_Offset(EntryElement,backgroundObj), "white" },
|
395
|
+
{0}
|
396
|
+
};
|
397
|
+
|
398
|
+
static void EntryElementSize(
|
399
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
400
|
+
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
|
401
|
+
{
|
402
|
+
*paddingPtr = Ttk_UniformPadding(5);
|
403
|
+
}
|
404
|
+
|
405
|
+
static void EntryElementDraw(
|
406
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
407
|
+
Drawable d, Ttk_Box b, Ttk_State state)
|
408
|
+
{
|
409
|
+
EntryElement *e = elementRecord;
|
410
|
+
Tk_3DBorder backgroundPtr = Tk_Get3DBorderFromObj(tkwin,e->backgroundObj);
|
411
|
+
Ttk_Box inner = Ttk_PadBox(b, Ttk_UniformPadding(3));
|
412
|
+
Rect bounds = BoxToRect(d, inner);
|
413
|
+
ThemeDrawState drawState = Ttk_StateTableLookup(ThemeStateTable, state);
|
414
|
+
|
415
|
+
/*
|
416
|
+
* Erase w/background color:
|
417
|
+
*/
|
418
|
+
XFillRectangle(Tk_Display(tkwin), d,
|
419
|
+
Tk_3DBorderGC(tkwin, backgroundPtr, TK_3D_FLAT_GC),
|
420
|
+
inner.x,inner.y, inner.width, inner.height);
|
421
|
+
|
422
|
+
BEGIN_DRAWING(d)
|
423
|
+
DrawThemeEditTextFrame(&bounds, drawState);
|
424
|
+
if (state & TTK_STATE_FOCUS) {
|
425
|
+
DrawThemeFocusRect(&bounds, 1);
|
426
|
+
}
|
427
|
+
END_DRAWING
|
428
|
+
}
|
429
|
+
|
430
|
+
static Ttk_ElementSpec EntryElementSpec = {
|
431
|
+
TK_STYLE_VERSION_2,
|
432
|
+
sizeof(EntryElement),
|
433
|
+
EntryElementOptions,
|
434
|
+
EntryElementSize,
|
435
|
+
EntryElementDraw
|
436
|
+
};
|
437
|
+
|
438
|
+
/*----------------------------------------------------------------------
|
439
|
+
* +++ Combobox:
|
440
|
+
*
|
441
|
+
* NOTES:
|
442
|
+
* kThemeMetricComboBoxLargeDisclosureWidth -> 17
|
443
|
+
* Padding and margins guesstimated by trial-and-error.
|
444
|
+
*/
|
445
|
+
|
446
|
+
static Ttk_Padding ComboboxPadding = { 2, 3, 17, 1 };
|
447
|
+
static Ttk_Padding ComboboxMargins = { 3, 3, 4, 4 };
|
448
|
+
|
449
|
+
static void ComboboxElementSize(
|
450
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
451
|
+
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
|
452
|
+
{
|
453
|
+
*widthPtr = 0;
|
454
|
+
*heightPtr = 0;
|
455
|
+
*paddingPtr = Ttk_AddPadding(ComboboxMargins, ComboboxPadding);
|
456
|
+
}
|
457
|
+
|
458
|
+
static void ComboboxElementDraw(
|
459
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
460
|
+
Drawable d, Ttk_Box b, Ttk_State state)
|
461
|
+
{
|
462
|
+
ThemeButtonParms *parms = clientData;
|
463
|
+
ThemeButtonDrawInfo info = computeButtonDrawInfo(parms, state);
|
464
|
+
Rect bounds = BoxToRect(d, Ttk_PadBox(b, ComboboxMargins));
|
465
|
+
|
466
|
+
BEGIN_DRAWING(d)
|
467
|
+
DrawThemeButton(
|
468
|
+
&bounds, kThemeComboBox, &info, NULL, NULL, NULL, 0);
|
469
|
+
END_DRAWING
|
470
|
+
}
|
471
|
+
|
472
|
+
static Ttk_ElementSpec ComboboxElementSpec = {
|
473
|
+
TK_STYLE_VERSION_2,
|
474
|
+
sizeof(NullElement),
|
475
|
+
TtkNullElementOptions,
|
476
|
+
ComboboxElementSize,
|
477
|
+
ComboboxElementDraw
|
478
|
+
};
|
479
|
+
|
480
|
+
/*----------------------------------------------------------------------
|
481
|
+
* +++ DrawThemeTrack-based elements --
|
482
|
+
* Progress bars and scales. (See also: <<NOTE-TRACKS>>)
|
483
|
+
*/
|
484
|
+
|
485
|
+
static Ttk_StateTable ThemeTrackEnableTable[] = {
|
486
|
+
{ kThemeTrackDisabled, TTK_STATE_DISABLED, 0 },
|
487
|
+
{ kThemeTrackInactive, TTK_STATE_BACKGROUND, 0 },
|
488
|
+
{ kThemeTrackActive, 0, 0 }
|
489
|
+
/* { kThemeTrackNothingToScroll, ?, ? }, */
|
490
|
+
};
|
491
|
+
|
492
|
+
typedef struct { /* TrackElement client data */
|
493
|
+
ThemeTrackKind kind;
|
494
|
+
SInt32 thicknessMetric;
|
495
|
+
} TrackElementData;
|
496
|
+
|
497
|
+
static TrackElementData ScaleData = {
|
498
|
+
kThemeSlider, kThemeMetricHSliderHeight
|
499
|
+
};
|
500
|
+
|
501
|
+
typedef struct {
|
502
|
+
Tcl_Obj *fromObj; /* minimum value */
|
503
|
+
Tcl_Obj *toObj; /* maximum value */
|
504
|
+
Tcl_Obj *valueObj; /* current value */
|
505
|
+
Tcl_Obj *orientObj; /* horizontal / vertical */
|
506
|
+
} TrackElement;
|
507
|
+
|
508
|
+
static Ttk_ElementOptionSpec TrackElementOptions[] = {
|
509
|
+
{ "-from", TK_OPTION_DOUBLE, Tk_Offset(TrackElement,fromObj) },
|
510
|
+
{ "-to", TK_OPTION_DOUBLE, Tk_Offset(TrackElement,toObj) },
|
511
|
+
{ "-value", TK_OPTION_DOUBLE, Tk_Offset(TrackElement,valueObj) },
|
512
|
+
{ "-orient", TK_OPTION_STRING, Tk_Offset(TrackElement,orientObj) },
|
513
|
+
{0,0,0}
|
514
|
+
};
|
515
|
+
|
516
|
+
static void TrackElementSize(
|
517
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
518
|
+
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
|
519
|
+
{
|
520
|
+
TrackElementData *data = clientData;
|
521
|
+
SInt32 size = 24; /* reasonable default ... */
|
522
|
+
|
523
|
+
GetThemeMetric(data->thicknessMetric, &size);
|
524
|
+
*widthPtr = *heightPtr = size;
|
525
|
+
}
|
526
|
+
|
527
|
+
static void TrackElementDraw(
|
528
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
529
|
+
Drawable d, Ttk_Box b, Ttk_State state)
|
530
|
+
{
|
531
|
+
TrackElementData *data = clientData;
|
532
|
+
TrackElement *elem = elementRecord;
|
533
|
+
double from = 0, to = 100, value = 0;
|
534
|
+
int orientation = TTK_ORIENT_HORIZONTAL;
|
535
|
+
ThemeTrackDrawInfo info;
|
536
|
+
|
537
|
+
Tcl_GetDoubleFromObj(NULL, elem->fromObj, &from);
|
538
|
+
Tcl_GetDoubleFromObj(NULL, elem->toObj, &to);
|
539
|
+
Tcl_GetDoubleFromObj(NULL, elem->valueObj, &value);
|
540
|
+
Ttk_GetOrientFromObj(NULL, elem->orientObj, &orientation);
|
541
|
+
|
542
|
+
/* @@@ BUG: min, max, and value should account for resolution:
|
543
|
+
* @@@ if finer than 1.0, conversion to int breaks.
|
544
|
+
*/
|
545
|
+
info.kind = data->kind;
|
546
|
+
info.bounds = BoxToRect(d, b);
|
547
|
+
info.min = (int)from; /* @@@ */
|
548
|
+
info.max = (int)to; /* @@@ */
|
549
|
+
info.value = (int)value; /* @@@ */
|
550
|
+
|
551
|
+
info.attributes = orientation == TTK_ORIENT_HORIZONTAL
|
552
|
+
? kThemeTrackHorizontal : 0;
|
553
|
+
info.attributes |= kThemeTrackShowThumb;
|
554
|
+
info.enableState = Ttk_StateTableLookup(ThemeTrackEnableTable, state);
|
555
|
+
|
556
|
+
switch (data->kind) {
|
557
|
+
case kThemeProgressBar:
|
558
|
+
info.trackInfo.progress.phase = 0; /* 1-4: animation phase */
|
559
|
+
break;
|
560
|
+
case kThemeSlider:
|
561
|
+
info.trackInfo.slider.pressState = 0; /* @@@ fill this in */
|
562
|
+
info.trackInfo.slider.thumbDir = kThemeThumbPlain;
|
563
|
+
/* kThemeThumbUpward, kThemeThumbDownward, kThemeThumbPlain */
|
564
|
+
break;
|
565
|
+
}
|
566
|
+
|
567
|
+
BEGIN_DRAWING(d)
|
568
|
+
DrawThemeTrack(&info, NULL, NULL, 0);
|
569
|
+
END_DRAWING
|
570
|
+
}
|
571
|
+
|
572
|
+
static Ttk_ElementSpec TrackElementSpec = {
|
573
|
+
TK_STYLE_VERSION_2,
|
574
|
+
sizeof(TrackElement),
|
575
|
+
TrackElementOptions,
|
576
|
+
TrackElementSize,
|
577
|
+
TrackElementDraw
|
578
|
+
};
|
579
|
+
|
580
|
+
/*
|
581
|
+
* Slider element -- <<NOTE-TRACKS>>
|
582
|
+
* Has geometry only. The Scale widget adjusts the position of this element,
|
583
|
+
* and uses it for hit detection. In the Aqua theme, the slider is actually
|
584
|
+
* drawn as part of the trough element.
|
585
|
+
*
|
586
|
+
* Also buggy: The geometry here is a Wild-Assed-Guess; I can't
|
587
|
+
* figure out how to get the Appearance Manager to tell me the
|
588
|
+
* slider size.
|
589
|
+
*/
|
590
|
+
static void SliderElementSize(
|
591
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
592
|
+
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
|
593
|
+
{
|
594
|
+
*widthPtr = *heightPtr = 24;
|
595
|
+
}
|
596
|
+
|
597
|
+
static Ttk_ElementSpec SliderElementSpec = {
|
598
|
+
TK_STYLE_VERSION_2,
|
599
|
+
sizeof(NullElement),
|
600
|
+
TtkNullElementOptions,
|
601
|
+
SliderElementSize,
|
602
|
+
TtkNullElementDraw
|
603
|
+
};
|
604
|
+
|
605
|
+
/*----------------------------------------------------------------------
|
606
|
+
* +++ Progress bar element (new):
|
607
|
+
*
|
608
|
+
* @@@ NOTE: According to an older revision of the Aqua reference docs,
|
609
|
+
* @@@ the 'phase' field is between 0 and 4. Newer revisions say
|
610
|
+
* @@@ that it can be any UInt8 value.
|
611
|
+
*/
|
612
|
+
|
613
|
+
typedef struct {
|
614
|
+
Tcl_Obj *orientObj; /* horizontal / vertical */
|
615
|
+
Tcl_Obj *valueObj; /* current value */
|
616
|
+
Tcl_Obj *maximumObj; /* maximum value */
|
617
|
+
Tcl_Obj *phaseObj; /* animation phase */
|
618
|
+
Tcl_Obj *modeObj; /* progress bar mode */
|
619
|
+
} PbarElement;
|
620
|
+
|
621
|
+
static Ttk_ElementOptionSpec PbarElementOptions[] = {
|
622
|
+
{ "-orient", TK_OPTION_STRING,
|
623
|
+
Tk_Offset(PbarElement,orientObj), "horizontal" },
|
624
|
+
{ "-value", TK_OPTION_DOUBLE,
|
625
|
+
Tk_Offset(PbarElement,valueObj), "0" },
|
626
|
+
{ "-maximum", TK_OPTION_DOUBLE,
|
627
|
+
Tk_Offset(PbarElement,maximumObj), "100" },
|
628
|
+
{ "-phase", TK_OPTION_INT,
|
629
|
+
Tk_Offset(PbarElement,phaseObj), "0" },
|
630
|
+
{ "-mode", TK_OPTION_STRING,
|
631
|
+
Tk_Offset(PbarElement,modeObj), "determinate" },
|
632
|
+
{0,0,0,0}
|
633
|
+
};
|
634
|
+
|
635
|
+
static void PbarElementSize(
|
636
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
637
|
+
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
|
638
|
+
{
|
639
|
+
SInt32 size = 24; /* @@@ Check HIG for correct default */
|
640
|
+
|
641
|
+
GetThemeMetric(kThemeMetricLargeProgressBarThickness, &size);
|
642
|
+
*widthPtr = *heightPtr = size;
|
643
|
+
}
|
644
|
+
|
645
|
+
static void PbarElementDraw(
|
646
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
647
|
+
Drawable d, Ttk_Box b, Ttk_State state)
|
648
|
+
{
|
649
|
+
PbarElement *pbar = elementRecord;
|
650
|
+
int orientation = TTK_ORIENT_HORIZONTAL;
|
651
|
+
double value = 0, maximum = 100;
|
652
|
+
int phase = 0;
|
653
|
+
ThemeTrackDrawInfo info;
|
654
|
+
|
655
|
+
Ttk_GetOrientFromObj(NULL, pbar->orientObj, &orientation);
|
656
|
+
Tcl_GetDoubleFromObj(NULL, pbar->valueObj, &value);
|
657
|
+
Tcl_GetDoubleFromObj(NULL, pbar->maximumObj, &maximum);
|
658
|
+
Tcl_GetIntFromObj(NULL, pbar->phaseObj, &phase);
|
659
|
+
|
660
|
+
if (!strcmp("indeterminate", Tcl_GetString(pbar->modeObj)) && value) {
|
661
|
+
info.kind = kThemeIndeterminateBar;
|
662
|
+
} else {
|
663
|
+
info.kind = kThemeProgressBar;
|
664
|
+
}
|
665
|
+
info.bounds = BoxToRect(d, b);
|
666
|
+
info.min = 0;
|
667
|
+
info.max = (int)maximum; /* @@@ See note above */
|
668
|
+
info.value = (int)value;
|
669
|
+
info.attributes = orientation == TTK_ORIENT_HORIZONTAL
|
670
|
+
? kThemeTrackHorizontal : 0;
|
671
|
+
info.attributes |= kThemeTrackShowThumb;
|
672
|
+
info.enableState = Ttk_StateTableLookup(ThemeTrackEnableTable, state);
|
673
|
+
info.trackInfo.progress.phase = phase;
|
674
|
+
|
675
|
+
BEGIN_DRAWING(d)
|
676
|
+
DrawThemeTrack(&info, NULL, NULL, 0);
|
677
|
+
END_DRAWING
|
678
|
+
}
|
679
|
+
|
680
|
+
static Ttk_ElementSpec PbarElementSpec = {
|
681
|
+
TK_STYLE_VERSION_2,
|
682
|
+
sizeof(PbarElement),
|
683
|
+
PbarElementOptions,
|
684
|
+
PbarElementSize,
|
685
|
+
PbarElementDraw
|
686
|
+
};
|
687
|
+
|
688
|
+
/*----------------------------------------------------------------------
|
689
|
+
* +++ Separator element.
|
690
|
+
*
|
691
|
+
* DrawThemeSeparator() guesses the orientation of the line from
|
692
|
+
* the width and height of the rectangle, so the same element can
|
693
|
+
* can be used for horizontal, vertical, and general separators.
|
694
|
+
*/
|
695
|
+
|
696
|
+
static void SeparatorElementSize(
|
697
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
698
|
+
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
|
699
|
+
{
|
700
|
+
*widthPtr = *heightPtr = 1;
|
701
|
+
}
|
702
|
+
|
703
|
+
static void SeparatorElementDraw(
|
704
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
705
|
+
Drawable d, Ttk_Box b, unsigned int state)
|
706
|
+
{
|
707
|
+
Rect bounds = BoxToRect(d, b);
|
708
|
+
ThemeDrawState drawState = Ttk_StateTableLookup(ThemeStateTable, state);
|
709
|
+
|
710
|
+
/*
|
711
|
+
* DrawThemeSeparator only supports kThemeStateActive / kThemeStateInactive
|
712
|
+
*/
|
713
|
+
state &= TTK_STATE_BACKGROUND;
|
714
|
+
BEGIN_DRAWING(d)
|
715
|
+
DrawThemeSeparator(&bounds, drawState);
|
716
|
+
END_DRAWING
|
717
|
+
}
|
718
|
+
|
719
|
+
static Ttk_ElementSpec SeparatorElementSpec = {
|
720
|
+
TK_STYLE_VERSION_2,
|
721
|
+
sizeof(NullElement),
|
722
|
+
TtkNullElementOptions,
|
723
|
+
SeparatorElementSize,
|
724
|
+
SeparatorElementDraw
|
725
|
+
};
|
726
|
+
|
727
|
+
/*----------------------------------------------------------------------
|
728
|
+
* +++ Size grip element.
|
729
|
+
*/
|
730
|
+
static const ThemeGrowDirection sizegripGrowDirection
|
731
|
+
= kThemeGrowRight|kThemeGrowDown;
|
732
|
+
|
733
|
+
static void SizegripElementSize(
|
734
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
735
|
+
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
|
736
|
+
{
|
737
|
+
Point origin = {0, 0};
|
738
|
+
Rect bounds;
|
739
|
+
|
740
|
+
GetThemeStandaloneGrowBoxBounds(
|
741
|
+
origin, sizegripGrowDirection, false, &bounds);
|
742
|
+
*widthPtr = bounds.right - bounds.left;
|
743
|
+
*heightPtr = bounds.bottom - bounds.top;
|
744
|
+
}
|
745
|
+
|
746
|
+
static void SizegripElementDraw(
|
747
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
748
|
+
Drawable d, Ttk_Box b, unsigned int state)
|
749
|
+
{
|
750
|
+
Rect bounds = BoxToRect(d, b);
|
751
|
+
Point origin = {bounds.top, bounds.left};
|
752
|
+
|
753
|
+
/* Grow box only supports kThemeStateActive, kThemeStateInactive */
|
754
|
+
state &= TTK_STATE_BACKGROUND;
|
755
|
+
|
756
|
+
BEGIN_DRAWING(d)
|
757
|
+
DrawThemeStandaloneGrowBox(
|
758
|
+
origin, sizegripGrowDirection, false,
|
759
|
+
Ttk_StateTableLookup(ThemeStateTable, state));
|
760
|
+
END_DRAWING
|
761
|
+
}
|
762
|
+
|
763
|
+
static Ttk_ElementSpec SizegripElementSpec = {
|
764
|
+
TK_STYLE_VERSION_2,
|
765
|
+
sizeof(NullElement),
|
766
|
+
TtkNullElementOptions,
|
767
|
+
SizegripElementSize,
|
768
|
+
SizegripElementDraw
|
769
|
+
};
|
770
|
+
|
771
|
+
/*----------------------------------------------------------------------
|
772
|
+
* +++ Background and fill elements.
|
773
|
+
*
|
774
|
+
* This isn't quite right: In Aqua, the correct background for
|
775
|
+
* a control depends on what kind of container it belongs to,
|
776
|
+
* and the type of the top-level window.
|
777
|
+
*
|
778
|
+
* Also: patterned backgrounds should be aligned with the coordinate
|
779
|
+
* system of the top-level window. If we're drawing into an
|
780
|
+
* off-screen graphics port this leads to alignment glitches.
|
781
|
+
*/
|
782
|
+
|
783
|
+
static void FillElementDraw(
|
784
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
785
|
+
Drawable d, Ttk_Box b, Ttk_State state)
|
786
|
+
{
|
787
|
+
Rect bounds = BoxToRect(d, b);
|
788
|
+
ThemeBrush brush = (state & TTK_STATE_BACKGROUND)
|
789
|
+
? kThemeBrushModelessDialogBackgroundInactive
|
790
|
+
: kThemeBrushModelessDialogBackgroundActive ;
|
791
|
+
|
792
|
+
BEGIN_DRAWING(d)
|
793
|
+
SetThemeBackground(brush, 32, true);
|
794
|
+
QDSetPatternOrigin(PatternOrigin(tkwin, d));
|
795
|
+
EraseRect(&bounds);
|
796
|
+
END_DRAWING
|
797
|
+
}
|
798
|
+
|
799
|
+
static void BackgroundElementDraw(
|
800
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
801
|
+
Drawable d, Ttk_Box b, unsigned int state)
|
802
|
+
{
|
803
|
+
FillElementDraw(
|
804
|
+
clientData, elementRecord, tkwin,
|
805
|
+
d, Ttk_WinBox(tkwin), state);
|
806
|
+
}
|
807
|
+
|
808
|
+
static Ttk_ElementSpec FillElementSpec = {
|
809
|
+
TK_STYLE_VERSION_2,
|
810
|
+
sizeof(NullElement),
|
811
|
+
TtkNullElementOptions,
|
812
|
+
TtkNullElementSize,
|
813
|
+
FillElementDraw
|
814
|
+
};
|
815
|
+
|
816
|
+
static Ttk_ElementSpec BackgroundElementSpec = {
|
817
|
+
TK_STYLE_VERSION_2,
|
818
|
+
sizeof(NullElement),
|
819
|
+
TtkNullElementOptions,
|
820
|
+
TtkNullElementSize,
|
821
|
+
BackgroundElementDraw
|
822
|
+
};
|
823
|
+
|
824
|
+
/*----------------------------------------------------------------------
|
825
|
+
* +++ ToolbarBackground element -- toolbar style for frames.
|
826
|
+
*
|
827
|
+
* This is very similar to the normal background element, but uses a
|
828
|
+
* different ThemeBrush in order to get the lighter pinstripe effect
|
829
|
+
* used in toolbars. We use SetThemeBackground() rather than
|
830
|
+
* ApplyThemeBackground() in order to get the right style.
|
831
|
+
*
|
832
|
+
* <URL: http://developer.apple.com/documentation/Carbon/Reference/
|
833
|
+
* Appearance_Manager/appearance_manager/constant_7.html#/
|
834
|
+
* /apple_ref/doc/uid/TP30000243/C005321>
|
835
|
+
*
|
836
|
+
*/
|
837
|
+
static void ToolbarBackgroundElementDraw(
|
838
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
839
|
+
Drawable d, Ttk_Box b, Ttk_State state)
|
840
|
+
{
|
841
|
+
ThemeBrush brush = kThemeBrushToolbarBackground;
|
842
|
+
Rect bounds = BoxToRect(d, Ttk_WinBox(tkwin));
|
843
|
+
|
844
|
+
BEGIN_DRAWING(d)
|
845
|
+
SetThemeBackground(brush, 32, true);
|
846
|
+
QDSetPatternOrigin(PatternOrigin(tkwin, d));
|
847
|
+
EraseRect(&bounds);
|
848
|
+
END_DRAWING
|
849
|
+
}
|
850
|
+
|
851
|
+
static Ttk_ElementSpec ToolbarBackgroundElementSpec = {
|
852
|
+
TK_STYLE_VERSION_2,
|
853
|
+
sizeof(NullElement),
|
854
|
+
TtkNullElementOptions,
|
855
|
+
TtkNullElementSize,
|
856
|
+
ToolbarBackgroundElementDraw
|
857
|
+
};
|
858
|
+
|
859
|
+
/*----------------------------------------------------------------------
|
860
|
+
* +++ Treeview header
|
861
|
+
* Redefine the header to use a kThemeListHeaderButton.
|
862
|
+
*/
|
863
|
+
|
864
|
+
static Ttk_StateTable TreeHeaderAdornmentTable[] = {
|
865
|
+
{ kThemeAdornmentHeaderButtonSortUp, TTK_STATE_ALTERNATE, 0 },
|
866
|
+
{ kThemeAdornmentFocus, TTK_STATE_FOCUS, 0 },
|
867
|
+
{ kThemeAdornmentNone, 0, 0 }
|
868
|
+
};
|
869
|
+
|
870
|
+
static void TreeHeaderElementDraw(
|
871
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
872
|
+
Drawable d, Ttk_Box b, Ttk_State state)
|
873
|
+
{
|
874
|
+
ThemeButtonParms *parms = clientData;
|
875
|
+
Rect bounds = BoxToRect(d, b);
|
876
|
+
ThemeButtonDrawInfo info;
|
877
|
+
|
878
|
+
info.state = Ttk_StateTableLookup(ThemeStateTable, state);
|
879
|
+
info.value = Ttk_StateTableLookup(ButtonValueTable, state);
|
880
|
+
info.adornment = Ttk_StateTableLookup(TreeHeaderAdornmentTable, state);
|
881
|
+
|
882
|
+
BEGIN_DRAWING(d)
|
883
|
+
DrawThemeButton(&bounds, parms->kind, &info, NULL, NULL, NULL, 0);
|
884
|
+
END_DRAWING
|
885
|
+
}
|
886
|
+
|
887
|
+
static Ttk_ElementSpec TreeHeaderElementSpec = {
|
888
|
+
TK_STYLE_VERSION_2,
|
889
|
+
sizeof(NullElement),
|
890
|
+
TtkNullElementOptions,
|
891
|
+
ButtonElementSizeNoPadding,
|
892
|
+
TreeHeaderElementDraw
|
893
|
+
};
|
894
|
+
|
895
|
+
/*
|
896
|
+
* Disclosure triangle:
|
897
|
+
*/
|
898
|
+
#define TTK_TREEVIEW_STATE_OPEN TTK_STATE_USER1
|
899
|
+
#define TTK_TREEVIEW_STATE_LEAF TTK_STATE_USER2
|
900
|
+
static Ttk_StateTable DisclosureValueTable[] = {
|
901
|
+
{ kThemeDisclosureDown, TTK_TREEVIEW_STATE_OPEN, 0 },
|
902
|
+
{ kThemeDisclosureRight, 0, 0 },
|
903
|
+
};
|
904
|
+
|
905
|
+
static void DisclosureElementSize(
|
906
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
907
|
+
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
|
908
|
+
{
|
909
|
+
SInt32 s;
|
910
|
+
GetThemeMetric(kThemeMetricDisclosureTriangleWidth, &s); *widthPtr = s;
|
911
|
+
GetThemeMetric(kThemeMetricDisclosureTriangleHeight, &s); *heightPtr = s;
|
912
|
+
}
|
913
|
+
|
914
|
+
static void DisclosureElementDraw(
|
915
|
+
void *clientData, void *elementRecord, Tk_Window tkwin,
|
916
|
+
Drawable d, Ttk_Box b, Ttk_State state)
|
917
|
+
{
|
918
|
+
Rect bounds = BoxToRect(d, b);
|
919
|
+
ThemeButtonDrawInfo info;
|
920
|
+
|
921
|
+
if (state & TTK_TREEVIEW_STATE_LEAF) {
|
922
|
+
return;
|
923
|
+
}
|
924
|
+
|
925
|
+
info.state = Ttk_StateTableLookup(ThemeStateTable, state);
|
926
|
+
info.value = Ttk_StateTableLookup(DisclosureValueTable, state);
|
927
|
+
info.adornment = kThemeAdornmentDrawIndicatorOnly;
|
928
|
+
|
929
|
+
BEGIN_DRAWING(d)
|
930
|
+
DrawThemeButton(
|
931
|
+
&bounds, kThemeDisclosureTriangle, &info, NULL, DontErase, NULL, 0);
|
932
|
+
END_DRAWING
|
933
|
+
}
|
934
|
+
|
935
|
+
static Ttk_ElementSpec DisclosureElementSpec = {
|
936
|
+
TK_STYLE_VERSION_2,
|
937
|
+
sizeof(NullElement),
|
938
|
+
TtkNullElementOptions,
|
939
|
+
DisclosureElementSize,
|
940
|
+
DisclosureElementDraw
|
941
|
+
};
|
942
|
+
|
943
|
+
/*----------------------------------------------------------------------
|
944
|
+
* +++ Widget layouts.
|
945
|
+
*/
|
946
|
+
|
947
|
+
TTK_BEGIN_LAYOUT_TABLE(LayoutTable)
|
948
|
+
|
949
|
+
TTK_LAYOUT("Toolbar",
|
950
|
+
TTK_NODE("Toolbar.background", TTK_FILL_BOTH))
|
951
|
+
|
952
|
+
TTK_LAYOUT("TButton",
|
953
|
+
TTK_GROUP("Button.button", TTK_FILL_BOTH,
|
954
|
+
TTK_GROUP("Button.padding", TTK_FILL_BOTH,
|
955
|
+
TTK_NODE("Button.label", TTK_FILL_BOTH))))
|
956
|
+
|
957
|
+
TTK_LAYOUT("TRadiobutton",
|
958
|
+
TTK_GROUP("Radiobutton.button", TTK_FILL_BOTH,
|
959
|
+
TTK_GROUP("Radiobutton.padding", TTK_FILL_BOTH,
|
960
|
+
TTK_NODE("Radiobutton.label", TTK_PACK_LEFT))))
|
961
|
+
|
962
|
+
TTK_LAYOUT("TCheckbutton",
|
963
|
+
TTK_GROUP("Checkbutton.button", TTK_FILL_BOTH,
|
964
|
+
TTK_GROUP("Checkbutton.padding", TTK_FILL_BOTH,
|
965
|
+
TTK_NODE("Checkbutton.label", TTK_PACK_LEFT))))
|
966
|
+
|
967
|
+
TTK_LAYOUT("TMenubutton",
|
968
|
+
TTK_GROUP("Menubutton.button", TTK_FILL_BOTH,
|
969
|
+
TTK_GROUP("Menubutton.padding", TTK_FILL_BOTH,
|
970
|
+
TTK_NODE("Menubutton.label", TTK_PACK_LEFT))))
|
971
|
+
|
972
|
+
TTK_LAYOUT("TCombobox",
|
973
|
+
TTK_GROUP("Combobox.button", TTK_PACK_TOP|TTK_FILL_X,
|
974
|
+
TTK_GROUP("Combobox.padding", TTK_FILL_BOTH,
|
975
|
+
TTK_NODE("Combobox.textarea", TTK_FILL_X))))
|
976
|
+
|
977
|
+
/* Notebook tabs -- no focus ring */
|
978
|
+
TTK_LAYOUT("Tab",
|
979
|
+
TTK_GROUP("Notebook.tab", TTK_FILL_BOTH,
|
980
|
+
TTK_GROUP("Notebook.padding", TTK_EXPAND|TTK_FILL_BOTH,
|
981
|
+
TTK_NODE("Notebook.label", TTK_EXPAND|TTK_FILL_BOTH))))
|
982
|
+
|
983
|
+
/* Progress bars -- track only */
|
984
|
+
TTK_LAYOUT("TProgressbar",
|
985
|
+
TTK_NODE("Progressbar.track", TTK_EXPAND|TTK_FILL_BOTH))
|
986
|
+
|
987
|
+
/* Tree heading -- no border, fixed height */
|
988
|
+
TTK_LAYOUT("Heading",
|
989
|
+
TTK_NODE("Treeheading.cell", TTK_FILL_X)
|
990
|
+
TTK_NODE("Treeheading.image", TTK_PACK_RIGHT)
|
991
|
+
TTK_NODE("Treeheading.text", 0))
|
992
|
+
|
993
|
+
/* Tree items -- omit focus ring */
|
994
|
+
TTK_LAYOUT("Item",
|
995
|
+
TTK_GROUP("Treeitem.padding", TTK_FILL_BOTH,
|
996
|
+
TTK_NODE("Treeitem.indicator", TTK_PACK_LEFT)
|
997
|
+
TTK_NODE("Treeitem.image", TTK_PACK_LEFT)
|
998
|
+
TTK_NODE("Treeitem.text", TTK_PACK_LEFT)))
|
999
|
+
|
1000
|
+
TTK_END_LAYOUT_TABLE
|
1001
|
+
|
1002
|
+
/*----------------------------------------------------------------------
|
1003
|
+
* +++ Initialization.
|
1004
|
+
*/
|
1005
|
+
|
1006
|
+
static int AquaTheme_Init(Tcl_Interp *interp)
|
1007
|
+
{
|
1008
|
+
Ttk_Theme themePtr = Ttk_CreateTheme(interp, "aqua", NULL);
|
1009
|
+
|
1010
|
+
if (!themePtr) {
|
1011
|
+
return TCL_ERROR;
|
1012
|
+
}
|
1013
|
+
|
1014
|
+
/*
|
1015
|
+
* Elements:
|
1016
|
+
*/
|
1017
|
+
Ttk_RegisterElementSpec(themePtr, "background", &BackgroundElementSpec, 0);
|
1018
|
+
Ttk_RegisterElementSpec(themePtr, "fill", &FillElementSpec, 0);
|
1019
|
+
Ttk_RegisterElementSpec(themePtr, "Toolbar.background",
|
1020
|
+
&ToolbarBackgroundElementSpec, 0);
|
1021
|
+
|
1022
|
+
Ttk_RegisterElementSpec(themePtr, "Button.button",
|
1023
|
+
&ButtonElementSpec, &PushButtonParms);
|
1024
|
+
Ttk_RegisterElementSpec(themePtr, "Checkbutton.button",
|
1025
|
+
&ButtonElementSpec, &CheckBoxParms);
|
1026
|
+
Ttk_RegisterElementSpec(themePtr, "Radiobutton.button",
|
1027
|
+
&ButtonElementSpec, &RadioButtonParms);
|
1028
|
+
Ttk_RegisterElementSpec(themePtr, "Toolbutton.border",
|
1029
|
+
&ButtonElementSpec, &BevelButtonParms);
|
1030
|
+
Ttk_RegisterElementSpec(themePtr, "Menubutton.button",
|
1031
|
+
&ButtonElementSpec, &PopupButtonParms);
|
1032
|
+
Ttk_RegisterElementSpec(themePtr, "Combobox.button",
|
1033
|
+
&ComboboxElementSpec, 0);
|
1034
|
+
Ttk_RegisterElementSpec(themePtr, "Treeitem.indicator",
|
1035
|
+
&DisclosureElementSpec, &DisclosureParms);
|
1036
|
+
Ttk_RegisterElementSpec(themePtr, "Treeheading.cell",
|
1037
|
+
&TreeHeaderElementSpec, &ListHeaderParms);
|
1038
|
+
|
1039
|
+
Ttk_RegisterElementSpec(themePtr, "Notebook.tab", &TabElementSpec, 0);
|
1040
|
+
Ttk_RegisterElementSpec(themePtr, "Notebook.client", &PaneElementSpec, 0);
|
1041
|
+
|
1042
|
+
Ttk_RegisterElementSpec(themePtr, "Labelframe.border",&GroupElementSpec,0);
|
1043
|
+
Ttk_RegisterElementSpec(themePtr, "Entry.field",&EntryElementSpec,0);
|
1044
|
+
|
1045
|
+
Ttk_RegisterElementSpec(themePtr, "separator",&SeparatorElementSpec,0);
|
1046
|
+
Ttk_RegisterElementSpec(themePtr, "hseparator",&SeparatorElementSpec,0);
|
1047
|
+
Ttk_RegisterElementSpec(themePtr, "vseparator",&SeparatorElementSpec,0);
|
1048
|
+
|
1049
|
+
Ttk_RegisterElementSpec(themePtr, "sizegrip",&SizegripElementSpec,0);
|
1050
|
+
|
1051
|
+
/*
|
1052
|
+
* <<NOTE-TRACKS>>
|
1053
|
+
* The Progressbar widget adjusts the size of the pbar element.
|
1054
|
+
* In the Aqua theme, the appearance manager computes the bar geometry;
|
1055
|
+
* we do all the drawing in the ".track" element and leave the .pbar out.
|
1056
|
+
*/
|
1057
|
+
Ttk_RegisterElementSpec(themePtr,"Scale.trough",
|
1058
|
+
&TrackElementSpec, &ScaleData);
|
1059
|
+
Ttk_RegisterElementSpec(themePtr,"Scale.slider",&SliderElementSpec,0);
|
1060
|
+
Ttk_RegisterElementSpec(themePtr,"Progressbar.track", &PbarElementSpec, 0);
|
1061
|
+
|
1062
|
+
/*
|
1063
|
+
* Layouts:
|
1064
|
+
*/
|
1065
|
+
Ttk_RegisterLayouts(themePtr, LayoutTable);
|
1066
|
+
|
1067
|
+
Tcl_PkgProvide(interp, "ttk::theme::aqua", TILE_VERSION);
|
1068
|
+
return TCL_OK;
|
1069
|
+
}
|
1070
|
+
|
1071
|
+
MODULE_SCOPE
|
1072
|
+
int Ttk_MacOSXPlatformInit(Tcl_Interp *interp)
|
1073
|
+
{
|
1074
|
+
return AquaTheme_Init(interp);
|
1075
|
+
}
|
1076
|
+
|