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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
#
# Demo: Layout
#
def demoLayout(t)
t.configure(:showroot=>false, :showrootbutton=>true, :showbuttons=>true,
:showlines=>true, :itemheight=>0, :selectmode=>:browse)
if $HasColumnCreate
t.column_create(:text=>'Layout')
else
t.column_configure(0, :text=>'Layout')
end
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, :showfocus=>true,
:fill=>[
@SystemHighlight, ['selected', 'focus'], 'gray80', []
])
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)
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=>['e1', 'e2'], :ipadx=>4, :ipady=>4, :pady=>2)
t.style_layout(s, 'e4', :detach=>true, :iexpand=>:es)
t.style_layout(s, 'e5', :detach=>true, :padx=>[2,0], :pady=>2, :iexpand=>:s)
t.style_layout(s, 'e6', :detach=>true, :expand=>:ws,
:padx=>[0,2], :pady=>[2,0])
t.style_layout(s, 'e7', :detach=>true, :expand=>:wn,
:padx=>[0,2], :pady=>[0,2])
if $Version_1_1_OrLater
i = t.item_create(:button=>true)
else
i = t.item_create
t.item_hasbutton(i, true)
end
t.item_style_set(i, 0, s)
t.item_lastchild(:root, i)
parent = i
i = t.item_create()
unless $Version_1_1_OrLater
t.item_hasbutton(i, false)
end
t.item_style_set(i, 0, s)
t.item_lastchild(parent, i)
###
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=>true, :iexpand=>:es)
if $Version_1_1_OrLater
i = t.item_create(:button=>true)
else
i = t.item_create
t.item_hasbutton(i, true)
end
t.item_style_set(i, 0, s)
t.item_lastchild(:root, i)
i2 = t.item_create()
unless $Version_1_1_OrLater
t.item_hasbutton(i2, false)
end
t.item_style_set(i2, 0, s)
t.item_lastchild(i, i2)
###
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])
if $Version_1_1_OrLater
i = t.item_create(:button=>true)
else
i = t.item_create
t.item_hasbutton(i, true)
end
t.item_style_set(i, 0, s)
t.item_lastchild(:root, i)
i2 = t.item_create()
unless $Version_1_1_OrLater
t.item_hasbutton(i2, false)
end
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=>true)
t.element_create('et', :text)
text = "Here is a text element surrounded by a border element.\nResize the column to watch me wrap."
s = t.style_create('e4')
t.style_elements(s, ['eb', 'et'])
t.style_layout(s, 'eb', :union=>['et'], :ipadx=>2, :ipady=>2)
t.style_layout(s, 'et', :squeeze=>:x)
if $Version_1_1_OrLater
i = t.item_create(:button=>true)
else
i = t.item_create
t.item_hasbutton(i, true)
end
t.item_style_set(i, 0, s)
t.item_text(i, 0, text)
t.item_lastchild(:root, i)
parent = i
i = t.item_create()
unless $Version_1_1_OrLater
t.item_hasbutton(i, false)
end
t.item_style_set(i, 0, s)
t.item_text(i, 0, text)
t.item_lastchild(parent, i)
###
styleNum = 5
[
[:horizontal, [:s, :ns, :n]],
[:vertical, [:e, :we, :w]]
].each{|orient, expandList|
expandList.each{|expand|
s = t.style_create("s#{styleNum}", :orient=>orient)
t.style_elements(s, ['e4', 'e8', 'e2', 'e5', 'e6'])
t.style_layout(s, 'e4', :detach=>true, :iexpand=>:es)
t.style_layout(s, 'e8', :detach=>true, :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)
styleNum += 1
i = t.item_create()
t.item_style_set(i, 0, s)
t.item_lastchild(:root, i)
}
}
end
|