summaryrefslogtreecommitdiffstats
path: root/doc/ttk_intro.n
diff options
context:
space:
mode:
authorhobbs <hobbs>2010-08-26 02:06:08 (GMT)
committerhobbs <hobbs>2010-08-26 02:06:08 (GMT)
commitb29adcfbfc2e03e058536524f1aa3378b948e7ed (patch)
treefa90e1e6d32590addfbb0a1599a40b1f7f99ea3b /doc/ttk_intro.n
parent7dec1714e5d5efd6b7d095657c1434fa68af0f87 (diff)
downloadtk-b29adcfbfc2e03e058536524f1aa3378b948e7ed.zip
tk-b29adcfbfc2e03e058536524f1aa3378b948e7ed.tar.gz
tk-b29adcfbfc2e03e058536524f1aa3378b948e7ed.tar.bz2
Major backport of 8.6 Ttk for 8.5.9. Most changes were only being
committed to head (8.6), although they could apply for 8.5 as well. This re-sync makes future work easier to maintain and adds some useful work for 8.5 users. Notable changes: - Lots of code cleanup - Some bug fixes never backported - Addition of ttk::spinbox - minor color changes - Improved Vista/7 styling - Move to tile version 0.8.6 (pseudo-package) - ABI and API compatible (even $w identify) - minor new features (extended $w identify)
Diffstat (limited to 'doc/ttk_intro.n')
-rw-r--r--doc/ttk_intro.n49
1 files changed, 32 insertions, 17 deletions
diff --git a/doc/ttk_intro.n b/doc/ttk_intro.n
index 912a5c0..81a1c7b 100644
--- a/doc/ttk_intro.n
+++ b/doc/ttk_intro.n
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: ttk_intro.n,v 1.10.2.1 2010/03/09 04:20:56 hobbs Exp $
+'\" RCS: @(#) $Id: ttk_intro.n,v 1.10.2.2 2010/08/26 02:06:09 hobbs Exp $
'\"
.so man.macros
.TH ttk::intro n 8.5 Tk "Tk Themed Widget"
@@ -13,6 +13,7 @@
ttk::intro \- Introduction to the Tk theme engine
.BE
.SH "OVERVIEW"
+.PP
The Tk themed widget set is based on a revised and enhanced version
of TIP #48 (http://tip.tcl.tk/48) specified style engine.
The main concepts are described below.
@@ -24,22 +25,24 @@ maintaining the widget state and invoking callbacks;
all aspects of the widget's appearance are controlled by the style of
the widget (i.e. the style of the elements of the widget).
.SH "THEMES"
+.PP
A \fItheme\fR is a collection of elements and styles
that determine the look and feel of the widget set.
Themes can be used to:
.IP \(bu
-Isolate platform differences (X11 vs. classic Windows vs. XP vs. Aqua ...)
+isolate platform differences (X11 vs. classic Windows vs. XP vs. Aqua ...)
.IP \(bu
-Adapt to display limitations (low-color, grayscale, monochrome, tiny screens)
+adapt to display limitations (low-color, grayscale, monochrome, tiny screens)
.IP \(bu
-Accessibility (high contrast, large type)
+accessibility (high contrast, large type)
.IP \(bu
-Application suite branding
+application suite branding
.IP \(bu
-Blend in with the rest of the desktop (Gnome, KDE, Java)
+blend in with the rest of the desktop (Gnome, KDE, Java)
.IP \(bu
-And, of course: eye candy.
+and, of course: eye candy.
.SH "ELEMENTS"
+.PP
An \fIelement\fR displays an individual part of a widget.
For example, a vertical scrollbar widget contains \fBuparrow\fR,
\fBdownarrow\fR, \fBtrough\fR and \fBslider\fR elements.
@@ -61,14 +64,15 @@ For example, the \fBtext\fR element
\fB\-underline\fR, and \fB\-width\fR options.
The value of an element option is taken from:
.IP \(bu
-An option of the same name and type in the widget containing the element;
+an option of the same name and type in the widget containing the element;
.IP \(bu
-A dynamic setting specified by \fBstyle map\fR and the current state;
+a dynamic setting specified by \fBstyle map\fR and the current state;
.IP \(bu
-The default setting specified by \fBstyle configure\fR; or
+the default setting specified by \fBstyle configure\fR; or
.IP \(bu
-The element's built-in default value for the option.
+the element's built-in default value for the option.
.SH "LAYOUTS"
+.PP
A \fIlayout\fR specifies which elements make up a widget
and how they are arranged.
The layout engine uses a simplified version of the \fBpack\fR
@@ -77,9 +81,10 @@ of the widget, elements are allocated a parcel within the cavity along
the side specified by the \fB\-side\fR option,
and placed within the parcel according to the \fB\-sticky\fR
option.
-For example, the layout for a horizontal scrollbar
+For example, the layout for a horizontal scrollbar is:
+.PP
.CS
-ttk::style layout Horizontal.TScrollbar {
+ttk::\fBstyle layout\fR Horizontal.TScrollbar {
Scrollbar.trough \-children {
Scrollbar.leftarrow \-side left \-sticky w
Scrollbar.rightarrow \-side right \-sticky e
@@ -87,10 +92,12 @@ ttk::style layout Horizontal.TScrollbar {
}
}
.CE
+.PP
By default, the layout for a widget is the same as its class name.
Some widgets may override this (for example, the \fBttk::scrollbar\fR
widget chooses different layouts based on the \fB\-orient\fR option).
.SH "STATES"
+.PP
In standard Tk, many widgets have a \fB\-state\fR option
which (in most cases) is either \fBnormal\fR or \fBdisabled\fR.
Some widgets support additional states, such
@@ -112,6 +119,7 @@ exclamation point indicating that the bit is cleared instead.
.PP
For example, the class bindings for the \fBttk::button\fR
widget are:
+.PP
.CS
bind TButton <Enter> { %W state active }
bind TButton <Leave> { %W state !active }
@@ -121,6 +129,7 @@ bind TButton <Button1-Enter> { %W state pressed }
bind TButton <ButtonRelease-1> \e
{ %W instate {pressed} { %W state !pressed ; %W invoke } }
.CE
+.PP
This specifies that the widget becomes \fBactive\fR when
the pointer enters the widget, and inactive when it leaves.
Similarly it becomes \fBpressed\fR when the mouse button is pressed,
@@ -133,28 +142,31 @@ Finally, when the mouse button is released, the widget's
in the \fBpressed\fR state.
(The actual bindings are a little more complicated than the above,
but not by much).
-.PP
-\fINote to self: rewrite that paragraph. It's horrible.\fR
+'\" Note to self: rewrite that paragraph. It's horrible.
.SH "STYLES"
+.PP
Each widget is associated with a \fIstyle\fR,
which specifies values for element options.
Style names use a recursive dotted notation like layouts and elements;
by default, widgets use the class name to look up a style in the current theme.
For example:
+.PP
.CS
-ttk::style configure TButton \e
+ttk::\fBstyle configure\fR TButton \e
\-background #d9d9d9 \e
\-foreground black \e
\-relief raised \e
;
.CE
+.PP
Many elements are displayed differently depending on the widget state.
For example, buttons have a different background when they are active,
a different foreground when disabled, and a different relief when pressed.
The \fBstyle map\fR command specifies dynamic option settings
for a particular style:
+.PP
.CS
-ttk::style map TButton \e
+ttk::\fBstyle map\fR TButton \e
\-background [list disabled #d9d9d9 active #ececec] \e
\-foreground [list disabled #a3a3a3] \e
\-relief [list {pressed !disabled} sunken] \e
@@ -162,3 +174,6 @@ ttk::style map TButton \e
.CE
.SH "SEE ALSO"
ttk::widget(n), ttk::style(n)
+'\" Local Variables:
+'\" mode: nroff
+'\" End: