1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
'\"
'\" Copyright (c) 2004 Joe English
'\" $Id: ttk_style.n,v 1.1 2006/10/31 01:42:25 hobbs Exp $
'\"
.so man.macros
.TH ttk_style n 8.5 Tk "Tk Themed Widget"
.BS
.SH NAME
ttk::style \- Control overall look and feel of widgets
.SH SYNOPSIS
\fBttk::style\fR \fIoption\fR ?\fIargs\fR?
.BE
.SH NOTES
.PP
This manpage has not been written yet.
Please see the Tcl'2004 conference presentation,
available at http://tktable.sourceforge.net/tile/tile-tcl2004.pdf
.SH DEFINITIONS
.PP
Each widget is assigned a \fIstyle\fR,
which specifies the set of elements making up the widget
and how they are arranged, along with dynamic and default
settings for element resources.
By default, the style name is the same as the widget's class;
this may be overridden by the \fB-style\fP option.
.PP
A \fItheme\fR is a collection of elements and styles
which controls the overall look and feel of an application.
.SH DESCRIPTION
The \fBttk::style\fR command takes the following arguments:
.TP
\fBttk::style configure \fIstyle\fR ?\fI-option \fR?\fIvalue option value...\fR? ?
Sets the default value of the specified option(s) in \fIstyle\fR.
.TP
\fBttk::style map \fIstyle\fR ?\fI-option\fR { \fIstatespec value\fR } ... ?
Sets dynamic values of the specified option(s) in \fIstyle\fR.
Each \fIstatespec / value\fR pair is examined in order;
the value corresponding to the first matching \fIstatespec\fP
is used.
.TP
\fBttk::style lookup \fIstyle\fR \fI-option \fR?\fIstate \fR?\fIdefault\fR??
Returns the value specified for \fI-option\fP in style \fIstyle\fP
in state \fIstate\fP, using the standard lookup rules for element options.
\fIstate\fR is a list of state names; if omitted,
it defaults to all bits off (the ``normal'' state).
If the \fIdefault\fP argument is present, it is used as a fallback
value in case no specification for \fI-option\fP is found.
.\" Otherwise -- signal error? return empty string? Leave unspecified for now.
.TP
\fBttk::style layout \fIstyle\fR ?\fIlayoutSpec\fR?
Define the widget layout for style \fIstyle\fR.
See "\fBLAYOUTS\fR" below for the format of \fIlayoutSpec\fR.
If \fIlayoutSpec\fR is omitted, return the layout specification
for style \fIstyle\fR.
.TP
\fBttk::style element create\fR \fIelementName\fR \fItype\fR ?\fIargs...\fR?
Creates a new element in the current theme of type \fItype\fR.
The only built-in element type is \fIimage\fR (see \fIimage(n)\fR),
although themes may define other element types
(see \fBTtk_RegisterElementFactory\fR).
.TP
\fBttk::style element names\fR
Returns the list of elements defined in the current theme.
.TP
\fBttk::style element options \fIelement\fR
Returns the list of \fIelement\fR's options.
.TP
\fBttk::style theme create\fR \fIthemeName\fR ?\fB-parent \fIbasedon\fR? ?\fB-settings \fIscript...\fR ?
Creates a new theme. It is an error if \fIthemeName\fR already exists.
If \fI-parent\fR is specified, the new theme will inherit
styles, elements, and layouts from the parent theme \fIbasedon\fB.
If \fI-settings\fR is present, \fIscript\fP is evaluated in the
context of the new theme as per \fBttk::style theme settings\fP.
.TP
\fBttk::style theme settings \fIthemeName\fP \fIscript\fP
Temporarily sets the current theme to \fIthemeName\fR,
evaluate \fIscript\fR, then restore the previous theme.
Typically \fIscript\fP simply defines styles and elements,
though arbitrary Tcl code may appear.
.TP
\fBttk::style theme names\fR
Returns a list of the available themes.
.TP
\fBttk::style theme use\fR \fIthemeName\fR
Sets the current theme to \fIthemeName\fR, and refreshes all widgets.
.SH LAYOUTS
A \fIlayout\fP specifies a list of elements, each followed
by one or more options specifying how to arrange the element.
The layout mechanism uses a simplified version of the \fBpack\fP
geometry manager: given an initial cavity,
each element is allocated a parcel.
Valid options are:
.TP
\fB-side \fIside\fR
Specifies which side of the cavity to place the element;
one of \fBleft\fP, \fBright\fP, \fBtop\fP, or \fBbottom\fP.
If omitted, the element occupies the entire cavity.
.TP
\fB-sticky \fI[nswe]\fR
Specifies where the element is placed inside its allocated parcel.
.TP
\fB-children \fI{ sublayout... }\fR
Specifies a list of elements to place inside the element.
.\" Also: -border, -unit, -expand: may go away.
.PP
For example:
.CS
ttk::style layout Horizontal.TScrollbar {
Scrollbar.trough -children {
Scrollbar.leftarrow -side left
Scrollbar.rightarrow -side right
Horizontal.Scrollbar.thumb -side left -sticky ew
}
}
.CE
.SH "SEE ALSO"
ttk_intro(n), ttk_widget(n), pixmap
.SH KEYWORDS
style, theme, appearance
|