1ttk_vsapi(n) Tk Themed Widget ttk_vsapi(n)
2
3
4
5______________________________________________________________________________
6
8 ttk_vsapi - Define a Microsoft Visual Styles element
9
11 ttk::style element create name vsapi className partId ?stateMap?
12 ?options?
13_________________________________________________________________
14
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 reponsible for the themed styles on Windows XP and Vista. This
19 factory permits any of the Visual Styles parts to be declared as ttk
20 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
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. This option may not be mixed with
35 any other options.
36
37 -margins padding
38 Specifies the elements exterior padding. padding is a list of
39 up to four integers specifying the left, top, right and bottom
40 padding quantities respectively. This option may not be mixed
41 with any other options.
42
43 -width width
44 Specifies the height for the element. If this option is set then
45 the Visual Styles API will not be queried for the recommended
46 size or the part. If this option is set then -height should also
47 be set. The -width and -height options cannot be mixed with the
48 -padding or -margins options.
49
50 -height height
51 Specifies the height of the element. See the comments for
52 -width.
53
55 The stateMap parameter is a list of ttk states and the corresponding
56 Visual Styles API state value. This permits the element appearence to
57 respond to changes in the widget state such as becoming active or being
58 pressed. The list should be as described for the ttk::style map command
59 but note that the last pair in the list should be the default state and
60 is typically and empty list and 1. Unfortunately all the Visual Styles
61 parts have different state values and these must be looked up either in
62 the Microsoft documentation or more likely in the header files. The
63 original header to use was tmschema.h but in more recent versions of
64 the Windows Development Kit this is vssym32.h.
65
66 If no stateMap parameter is given there is an implicit default map of
67 {{} 1}
68
70 Create a correctly themed close button by changing the layout of a
71 ttk::button(n). This uses the WINDOW part WP_SMALLCLOSEBUTTON and as
72 documented the states CBS_DISABLED, CBS_HOT, CBS_NORMAL and CBS_PUSHED
73 are mapped from ttk states.
74 ttk::style element create smallclose vsapi WINDOW 19 \
75 {disabled 4 pressed 3 active 2 {} 1}
76 ttk::style layout CloseButton {CloseButton.smallclose -sticky news}
77 pack [ttk::button .close -style CloseButton]
78
79 Change the appearence of a ttk::checkbutton(n) to use the Explorer pin
80 part EBP_HEADERPIN.
81 ttk::style element create pin vsapi EXPLORERBAR 3 {
82 {pressed !selected} 3
83 {active !selected} 2
84 {pressed selected} 6
85 {active selected} 5
86 {selected} 4
87 {} 1
88 }
89 ttk::style layout Explorer.Pin {Explorer.Pin.pin -sticky news}
90 pack [ttk::checkbutton .pin -style Explorer.Pin]
91
93 ttk::intro(n), ttk::widget(n), ttk::style(n), ttk_image(n)
94
96 style, theme, appearance, windows
97
98
99
100Tk 8.5 ttk_vsapi(n)