blob: f36da74f60382e38af465436b34e0994bf5b418c (
plain)
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
122
123
124
125
126
127
128
129
130
|
#
# Demo: Layout
#
proc DemoLayout {} {
set T .f2.f1.t
$T configure -showroot no -showrootbutton yes -showbuttons yes \
-showlines yes -itemheight 0 -selectmode browse
$T column configure 0 -text Layout
$T element create e1 rect -width 30 -height 30 -fill gray20
$T element create e2 rect -width 30 -height 30 -fill gray40 \
-outline blue -outlinewidth 3
$T element create e3 rect -fill gray60
$T element create e4 rect -fill [list $::SystemHighlight {selected focus} gray80 {}] \
-showfocus yes
$T element create e5 rect -fill {"sky blue"} -width 20 -height 20
$T element create e6 rect -fill {"sea green"} -width 30 -height 16
$T element create e7 rect -fill {"sky blue"} -width 30 -height 16
$T element create e8 rect -fill gray70 -height 1
set S [$T style create s1]
$T style elements $S {e4 e3 e1 e2 e5 e6 e7}
$T style layout $S e1 -padx {28 4} -pady 4
$T style layout $S e2 -expand es -padx {0 38}
$T style layout $S e3 -union [list e1 e2] -ipadx 4 -ipady 4 -pady 2
$T style layout $S e4 -detach yes -iexpand es
$T style layout $S e5 -detach yes -padx {2 0} -pady 2 -iexpand s
$T style layout $S e6 -detach yes -expand ws -padx {0 2} -pady {2 0}
$T style layout $S e7 -detach yes -expand wn -padx {0 2} -pady {0 2}
set I [$T item create]
$T item hasbutton $I yes
$T item style set $I 0 $S
$T item lastchild root $I
set parent $I
set I [$T item create]
$T item hasbutton $I no
$T item style set $I 0 $S
$T item lastchild $parent $I
###
set S [$T style create s2]
$T style elements $S {e4 e3 e1}
$T style layout $S e1 -padx 8 -pady 8 -iexpand e
$T style layout $S e3 -union e1 -ipadx {20 4} -ipady {4 12}
$T style layout $S e4 -detach yes -iexpand es
set I [$T item create]
$T item hasbutton $I yes
$T item style set $I 0 $S
$T item lastchild root $I
set I2 [$T item create]
$T item hasbutton $I2 no
$T item style set $I2 0 $S
$T item lastchild $I $I2
###
set S [$T style create s3]
$T style elements $S {e4 e3 e1 e5 e6}
$T style layout $S e4 -union {e1 e6} -ipadx 8 -ipady {8 0}
$T style layout $S e3 -union {e1 e5} -ipadx 4 -ipady 4
$T style layout $S e5 -ipady {0 20}
set I [$T item create]
$T item hasbutton $I yes
$T item style set $I 0 $S
$T item lastchild root $I
set I2 [$T item create]
$T item hasbutton $I2 no
$T item style set $I2 0 $S
$T item lastchild $I $I2
###
$T element create eb border -background $::SystemButtonFace \
-relief {sunken {selected} raised {}} -thickness 2 -filled yes
$T element create et text
set text "Here is a text element surrounded by a border element.\nResize the column to watch me wrap."
set S [$T style create s4]
$T style elements $S {eb et}
$T style layout $S eb -union et -ipadx 2 -ipady 2
$T style layout $S et -squeeze x
set I [$T item create]
$T item hasbutton $I yes
$T item style set $I 0 $S
$T item text $I 0 $text
$T item lastchild root $I
set parent $I
set I [$T item create]
$T item hasbutton $I no
$T item style set $I 0 $S
$T item text $I 0 $text
$T item lastchild $parent $I
###
set styleNum 5
foreach {orient expandList} {horizontal {s ns n} vertical {e we w}} {
foreach expand $expandList {
set S [$T style create s$styleNum -orient $orient]
$T style elements $S {e4 e8 e2 e5 e6}
$T style layout $S e4 -detach yes -iexpand es
$T style layout $S e8 -detach yes -expand n -iexpand e
$T style layout $S e2 -expand $expand
$T style layout $S e5 -expand $expand
$T style layout $S e6 -expand $expand
incr styleNum
set I [$T item create]
$T item style set $I 0 $S
$T item lastchild root $I
}
}
return
}
|