1ttk_vsapi(n)                   Tk Themed Widget                   ttk_vsapi(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       ttk_vsapi - Define a Microsoft Visual Styles element
9

SYNOPSIS

11       ttk::style  element  create  name  vsapi  className  partId  ?stateMap?
12       ?options?
13______________________________________________________________________________
14

DESCRIPTION

16       The vsapi element factory creates a new element in  the  current  theme
17       whose  visual appearance is drawn using the Microsoft Visual Styles API
18       which is responsible for the themed styles on  Windows  XP  and  Vista.
19       This  factory  permits any of the Visual Styles parts to be declared as
20       Ttk elements that can then be included in a style layout to modify  the
21       appearance of Ttk widgets.
22
23       className  and  partId  are  required parameters and specify the Visual
24       Styles class and part as given  in  the  Microsoft  documentation.  The
25       stateMap  may be provided to map Ttk states to Visual Styles API states
26       (see STATE MAP).
27

OPTIONS

29       Valid options are:
30
31       -padding padding
32              Specify the element's interior padding.  padding is a list of up
33              to four integers specifying the left, top, right and bottom pad‐
34              ding quantities respectively.  If fewer than four  elements  are
35              specified,  bottom  defaults to top, right defaults to left, and
36              top defaults to left.  In other words, a list of  three  numbers
37              specify  the  left,  vertical,  and right padding; a list of two
38              numbers specify the horizontal and the vertical padding; a  sin‐
39              gle  number  specifies  the  same padding all the way around the
40              widget.  This option may not be mixed with any other options.
41
42       -margins padding
43              Specifies the elements exterior padding.  padding is a  list  of
44              up  to  four integers specifying the left, top, right and bottom
45              padding quantities respectively.  This option may not  be  mixed
46              with any other options.
47
48       -width width
49              Specifies the height for the element. If this option is set then
50              the Visual Styles API will not be queried  for  the  recommended
51              size or the part. If this option is set then -height should also
52              be set. The -width and -height options cannot be mixed with  the
53              -padding or -margins options.
54
55       -height height
56              Specifies  the  height  of  the  element.  See  the comments for
57              -width.
58

STATE MAP

60       The stateMap parameter is a list of ttk states  and  the  corresponding
61       Visual  Styles API state value.  This permits the element appearance to
62       respond to changes in the widget state such as becoming active or being
63       pressed. The list should be as described for the ttk::style map command
64       but note that the last pair in the list should be the default state and
65       is  typically  an empty list and 1. Unfortunately all the Visual Styles
66       parts have different state values and these must be looked up either in
67       the  Microsoft  documentation  or  more likely in the header files. The
68       original header to use was tmschema.h, but in more recent  versions  of
69       the Windows Development Kit this is vssym32.h.
70
71       If  no  stateMap parameter is given there is an implicit default map of
72       {{} 1}
73

EXAMPLE

75       Create a correctly themed close button by  changing  the  layout  of  a
76       ttk::button(n).  This  uses  the WINDOW part WP_SMALLCLOSEBUTTON and as
77       documented the states CBS_DISABLED, CBS_HOT, CBS_NORMAL and  CBS_PUSHED
78       are mapped from ttk states.
79              ttk::style element create smallclose vsapi WINDOW 19 \
80                  {disabled 4 pressed 3 active 2 {} 1}
81              ttk::style layout CloseButton {CloseButton.smallclose -sticky news}
82              pack [ttk::button .close -style CloseButton]
83
84       Change  the appearance of a ttk::checkbutton(n) to use the Explorer pin
85       part EBP_HEADERPIN.
86              ttk::style element create pin vsapi EXPLORERBAR 3 {
87                  {pressed !selected} 3
88                  {active !selected} 2
89                  {pressed selected} 6
90                  {active selected} 5
91                  {selected} 4
92                  {} 1
93              }
94              ttk::style layout Explorer.Pin {Explorer.Pin.pin -sticky news}
95              pack [ttk::checkbutton .pin -style Explorer.Pin]
96

SEE ALSO

98       ttk::intro(n), ttk::widget(n), ttk::style(n), ttk_image(n)
99

KEYWORDS

101       style, theme, appearance, windows
102
103
104
105Tk                                    8.5                         ttk_vsapi(n)
Impressum