author | Claus Gittinger <cg@exept.de> |
Tue, 02 Nov 2010 22:00:38 +0100 | |
changeset 3961 | 6cd0b3929aa2 |
parent 3933 | 95e42631bf60 |
child 4159 | a4bd3b389805 |
permissions | -rw-r--r-- |
696 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
1777
1c09f7e0a18a
set masterApplication ... in case of an ApplicationModel
tm
parents:
1761
diff
changeset
|
12 |
"{ Package: 'stx:libwidg2' }" |
1759 | 13 |
|
696 | 14 |
Model subclass:#TabItem |
3191 | 15 |
instanceVariableNames:'view rawLabel label enabled argument canvas activeHelpText |
3416
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
16 |
translateLabel applicationProvidesLabel shortcutKey majorKey |
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
17 |
minorKey miniScrollerVertical miniScrollerHorizontal |
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
18 |
hasVerticalScrollBar hasHorizontalScrollBar foregroundColor |
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
19 |
createNewBuilder autoHideScrollBars accessCharacterPosition |
3933 | 20 |
activeHelpKey builder nameKey' |
696 | 21 |
classVariableNames:'' |
22 |
poolDictionaries:'' |
|
23 |
category:'Views-Support' |
|
24 |
! |
|
25 |
||
26 |
!TabItem class methodsFor:'documentation'! |
|
27 |
||
28 |
copyright |
|
29 |
" |
|
30 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
31 |
All Rights Reserved |
|
32 |
||
33 |
This software is furnished under a license and may be used |
|
34 |
only in accordance with the terms of that license and with the |
|
35 |
inclusion of the above copyright notice. This software may not |
|
36 |
be provided or otherwise made available to, or used by, any |
|
37 |
other person. No title to or ownership of the software is |
|
38 |
hereby transferred. |
|
39 |
" |
|
40 |
||
41 |
! |
|
42 |
||
43 |
documentation |
|
44 |
" |
|
45 |
describes one tab entry; could be used for tabs instead of a string. Whenever |
|
46 |
a value changed, a change notification is raised |
|
47 |
||
48 |
[see also:] |
|
49 |
TabItemEditor |
|
50 |
TabView |
|
51 |
NoteBookView |
|
52 |
UIPainter |
|
53 |
||
54 |
[author:] |
|
55 |
Claus Atzkern |
|
56 |
" |
|
57 |
||
58 |
||
59 |
! |
|
60 |
||
61 |
examples |
|
62 |
" |
|
63 |
labels derived from item |
|
64 |
[exBegin] |
|
65 |
|top tab| |
|
66 |
||
67 |
top := StandardSystemView new label:'tabs at top'; extent:250@100. |
|
68 |
tab := TabView origin:0.0 @ 0.0 corner:1.0 @ 0.5 in:top. |
|
69 |
||
70 |
tab direction:#top. |
|
71 |
tab list:(#( 'Foo' 'Bar' 'Baz' ) collect:[:l| TabItem label:l ]). |
|
72 |
tab action:[:aName|Transcript showCR:aName]. |
|
73 |
top open. |
|
74 |
[exEnd] |
|
75 |
||
3516 | 76 |
[exBegin] |
77 |
|top tab list item| |
|
78 |
||
79 |
top := StandardSystemView new label:'tabs at top'; extent:400@400. |
|
80 |
tab := NoteBookView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
|
81 |
||
82 |
tab direction:#top. |
|
83 |
list := #( 'Foo' 'Bar' 'Baz' ) collect:[:l| TabItem label:l ]. |
|
84 |
||
85 |
item := list at:1. |
|
86 |
item majorKey:ClockView. |
|
87 |
||
88 |
item := list at:2. |
|
89 |
item majorKey:CodingExamples_GUI::GUIDemoNoteBook. |
|
90 |
||
91 |
item := list at:3. |
|
92 |
item majorKey:CodingExamples_GUI::GUIDemoMenu. |
|
93 |
||
94 |
tab list:list. |
|
95 |
top open. |
|
96 |
[exEnd] |
|
696 | 97 |
|
98 |
testing tab configuration and change notifications |
|
99 |
[exBegin] |
|
100 |
|top tab list idx label| |
|
101 |
||
102 |
top := StandardSystemView new label:'tabs at top'; extent:250@100. |
|
103 |
tab := TabView origin:0.0 @ 0.0 corner:1.0 @ 0.5 in:top. |
|
104 |
||
105 |
tab direction:#top. |
|
106 |
list := (#( 'Foo' 'Bar' 'Baz' ) collect:[:l| TabItem label:l ]). |
|
107 |
tab list:list. |
|
108 |
tab action:[:aName|Transcript showCR:aName]. |
|
109 |
top openAndWait. |
|
110 |
||
111 |
[ |
|
112 |
idx := 0. |
|
113 |
label := LabelAndIcon icon:(Image fromFile:('xpmBitmaps/document_images/tiny_yellow_dir.xpm' )) |
|
114 |
string:'Test Tab'. |
|
115 |
||
116 |
[top shown] whileTrue:[ |
|
117 |
|aTab lbl| |
|
118 |
||
119 |
(idx := idx + 1) > list size ifTrue:[idx := 1]. |
|
120 |
||
121 |
aTab := list at:idx. |
|
122 |
lbl := aTab label. |
|
123 |
||
124 |
Delay waitForSeconds:0.5. aTab label:label. |
|
125 |
Delay waitForSeconds:0.5. aTab enabled:false. |
|
126 |
Delay waitForSeconds:0.5. aTab enabled:true. |
|
127 |
Delay waitForSeconds:0.5. aTab foregroundColor:(Color red). |
|
128 |
Delay waitForSeconds:0.5. aTab foregroundColor:nil. |
|
129 |
aTab label:lbl. |
|
130 |
] |
|
131 |
] forkAt:1. |
|
132 |
[exEnd] |
|
133 |
||
134 |
" |
|
135 |
! ! |
|
136 |
||
137 |
!TabItem class methodsFor:'instance creation'! |
|
138 |
||
139 |
label:aLabel |
|
140 |
^ self new label:aLabel |
|
141 |
! ! |
|
142 |
||
143 |
!TabItem methodsFor:'accessing'! |
|
144 |
||
1671 | 145 |
accessCharacterPosition |
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
146 |
"get the index of the access character in the label text or string, or 0 if none" |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
147 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
148 |
^ accessCharacterPosition ? 0 |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
149 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
150 |
"Modified: / 06-09-2006 / 14:57:08 / cg" |
1671 | 151 |
! |
152 |
||
1759 | 153 |
accessCharacterPosition:anIndex |
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
154 |
"set the index of the access character in the label" |
1759 | 155 |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
156 |
accessCharacterPosition := anIndex |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
157 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
158 |
"Modified: / 06-09-2006 / 14:57:44 / cg" |
1671 | 159 |
! |
160 |
||
716 | 161 |
argument |
162 |
"returns a user defined argument or nil |
|
163 |
" |
|
164 |
^ argument |
|
165 |
! |
|
166 |
||
167 |
argument:anArgument |
|
168 |
"set a user defined argument |
|
169 |
" |
|
1674 | 170 |
(anArgument isString and:[anArgument isEmpty]) ifTrue:[ |
171 |
argument := nil |
|
172 |
] ifFalse:[ |
|
173 |
argument := anArgument |
|
174 |
]. |
|
716 | 175 |
argument := anArgument |
176 |
! |
|
177 |
||
1759 | 178 |
createNewBuilder |
179 |
"returns true if a new builder is used to create the canvas; |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
180 |
the default is true" |
1759 | 181 |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
182 |
^ createNewBuilder ? true |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
183 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
184 |
"Modified: / 06-09-2006 / 14:58:58 / cg" |
1759 | 185 |
! |
186 |
||
187 |
createNewBuilder:aBool |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
188 |
"set/clear the flag which controls if a new ui-builder is used to create the canvas; |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
189 |
the default is true. This affects if the bindings will be shared or not between tabs." |
1759 | 190 |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
191 |
createNewBuilder := aBool |
1759 | 192 |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
193 |
"Modified: / 06-09-2006 / 15:00:04 / cg" |
1759 | 194 |
! |
195 |
||
696 | 196 |
enabled |
197 |
"get the enabled state of the tab |
|
198 |
" |
|
199 |
^ enabled ? true |
|
200 |
! |
|
201 |
||
202 |
enabled:aState |
|
203 |
"set the enabled state of the tab |
|
204 |
" |
|
205 |
|s| |
|
206 |
||
207 |
s := aState ? true. |
|
208 |
||
209 |
self enabled ~~ s ifTrue:[ |
|
210 |
enabled := s. |
|
211 |
self changed:#enabled |
|
212 |
] |
|
213 |
! |
|
214 |
||
215 |
foregroundColor |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
216 |
"get the label color or nil" |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
217 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
218 |
^ foregroundColor |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
219 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
220 |
"Modified: / 06-09-2006 / 15:14:46 / cg" |
696 | 221 |
! |
222 |
||
223 |
foregroundColor:aColor |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
224 |
"set the label color or nil" |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
225 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
226 |
foregroundColor ~= aColor ifTrue:[ |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
227 |
foregroundColor := aColor. |
696 | 228 |
self changed:#foregroundColor |
1759 | 229 |
]. |
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
230 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
231 |
"Modified: / 06-09-2006 / 15:00:31 / cg" |
696 | 232 |
! |
233 |
||
3296 | 234 |
hasView |
235 |
^ view notNil |
|
236 |
! |
|
237 |
||
696 | 238 |
label |
239 |
"get the label or selector to access a label/bitmap. To get the label to be shown |
|
240 |
use: #rawLabel |
|
241 |
" |
|
242 |
^ label |
|
243 |
! |
|
244 |
||
245 |
label:aLabel |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
246 |
"set the label or selector to access the label/bitmap" |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
247 |
|
696 | 248 |
label := aLabel. |
249 |
||
1936
ce9aa6069889
in #label: treat label as different, if emphasis is.
Claus Gittinger <cg@exept.de>
parents:
1891
diff
changeset
|
250 |
(aLabel ~= rawLabel |
3346 | 251 |
or:[aLabel class ~~ rawLabel class |
1936
ce9aa6069889
in #label: treat label as different, if emphasis is.
Claus Gittinger <cg@exept.de>
parents:
1891
diff
changeset
|
252 |
or:[aLabel isString |
ce9aa6069889
in #label: treat label as different, if emphasis is.
Claus Gittinger <cg@exept.de>
parents:
1891
diff
changeset
|
253 |
and:[rawLabel isString |
3346 | 254 |
and:[(aLabel sameStringAndEmphasisAs:rawLabel) not]]]]) |
1936
ce9aa6069889
in #label: treat label as different, if emphasis is.
Claus Gittinger <cg@exept.de>
parents:
1891
diff
changeset
|
255 |
|
ce9aa6069889
in #label: treat label as different, if emphasis is.
Claus Gittinger <cg@exept.de>
parents:
1891
diff
changeset
|
256 |
ifTrue:[ |
696 | 257 |
rawLabel := aLabel. |
258 |
self changed |
|
259 |
] |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
260 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
261 |
"Modified: / 06-09-2006 / 15:54:13 / cg" |
696 | 262 |
! |
263 |
||
264 |
labelForegroundColor |
|
265 |
"get the label color or nil |
|
266 |
" |
|
267 |
^ self foregroundColor |
|
268 |
! |
|
269 |
||
270 |
labelForegroundColor:aColor |
|
271 |
"set the label color or nil |
|
272 |
" |
|
273 |
self foregroundColor:aColor |
|
1671 | 274 |
! |
275 |
||
3933 | 276 |
nameKey |
277 |
"an additional (untranslated) key (do not use the label to identify tabs)" |
|
278 |
||
279 |
^ nameKey |
|
280 |
||
281 |
"Created: / 21-09-2010 / 16:57:54 / cg" |
|
282 |
! |
|
283 |
||
284 |
nameKey:aStringOrSymbol |
|
285 |
"an additional (untranslated) key (do not use the label to identify tabs)" |
|
286 |
||
287 |
nameKey := aStringOrSymbol |
|
288 |
||
289 |
"Created: / 21-09-2010 / 16:58:05 / cg" |
|
290 |
! |
|
291 |
||
1671 | 292 |
shortcutKey |
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
293 |
"get the key to press to select the tab item from the keyboard; a symbol or nil" |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
294 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
295 |
^ shortcutKey |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
296 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
297 |
"Modified: / 06-09-2006 / 15:09:18 / cg" |
1671 | 298 |
! |
299 |
||
300 |
shortcutKey:aKeyOrNil |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
301 |
"set the key to press to select the tab item from the keyboard; a symbol or nil" |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
302 |
|
1759 | 303 |
|key| |
304 |
||
305 |
aKeyOrNil size ~~ 0 ifTrue:[ |
|
306 |
key := aKeyOrNil asSymbol |
|
307 |
]. |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
308 |
shortcutKey := key |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
309 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
310 |
"Modified: / 06-09-2006 / 15:09:31 / cg" |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
311 |
! |
1759 | 312 |
|
3919 | 313 |
view |
314 |
^ view |
|
315 |
||
316 |
"Created: / 25-07-2010 / 11:58:53 / cg" |
|
317 |
! |
|
318 |
||
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
319 |
view:aView |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
320 |
aView isNil ifTrue:[ |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
321 |
view := aView. |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
322 |
^ self. |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
323 |
]. |
1759 | 324 |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
325 |
view notNil ifTrue:[ |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
326 |
aView ~~ view ifTrue:[ |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
327 |
self error:'TabItems cannot be reused'. |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
328 |
]. |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
329 |
]. |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
330 |
view := aView. |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
331 |
self setAttributesWithBuilder:view application builder. |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
332 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
333 |
"Modified: / 06-09-2006 / 17:58:58 / cg" |
1759 | 334 |
! ! |
335 |
||
2404 | 336 |
!TabItem methodsFor:'accessing-canvas'! |
1759 | 337 |
|
338 |
canvas |
|
3437 | 339 |
"returns the application or view. Creates one if not already present" |
3358 | 340 |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
341 |
|view cls wsel classNameKey oldBuilder usedBuilder appl| |
1759 | 342 |
|
343 |
canvas notNil ifTrue:[ |
|
344 |
^ canvas |
|
345 |
]. |
|
346 |
||
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
347 |
(classNameKey := majorKey) notNil ifTrue:[ |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
348 |
oldBuilder := builder. |
1891
ab8801a1c22d
subapps always got a new builder (even if one was already present)
tm
parents:
1777
diff
changeset
|
349 |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
350 |
(oldBuilder notNil |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
351 |
and:[(appl := oldBuilder application) notNil]) ifTrue:[ |
2848 | 352 |
canvas := appl subApplicationFor:majorKey. |
353 |
canvas isNil ifTrue:[ |
|
354 |
cls := appl resolveName:classNameKey. |
|
1777
1c09f7e0a18a
set masterApplication ... in case of an ApplicationModel
tm
parents:
1761
diff
changeset
|
355 |
] |
1c09f7e0a18a
set masterApplication ... in case of an ApplicationModel
tm
parents:
1761
diff
changeset
|
356 |
] ifFalse:[ |
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
357 |
"/ cls := Smalltalk resolveName:classNameKey inClass:self class. |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
358 |
cls := Smalltalk classNamed:classNameKey. |
1759 | 359 |
]. |
1777
1c09f7e0a18a
set masterApplication ... in case of an ApplicationModel
tm
parents:
1761
diff
changeset
|
360 |
canvas isNil ifTrue:[ |
1c09f7e0a18a
set masterApplication ... in case of an ApplicationModel
tm
parents:
1761
diff
changeset
|
361 |
cls isNil ifTrue:[ |
2491 | 362 |
self error:('no canvas for majorKey: ' , classNameKey) mayProceed:true. |
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
363 |
"/ self majorKey:nil. |
2491 | 364 |
^ nil |
1777
1c09f7e0a18a
set masterApplication ... in case of an ApplicationModel
tm
parents:
1761
diff
changeset
|
365 |
]. |
1c09f7e0a18a
set masterApplication ... in case of an ApplicationModel
tm
parents:
1761
diff
changeset
|
366 |
canvas := cls new. |
1c09f7e0a18a
set masterApplication ... in case of an ApplicationModel
tm
parents:
1761
diff
changeset
|
367 |
]. |
1759 | 368 |
|
2723 | 369 |
self isCanvasApplicationModel ifTrue:[ |
2794 | 370 |
view := ApplicationSubView new. |
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
371 |
wsel := minorKey ? #windowSpec. |
1777
1c09f7e0a18a
set masterApplication ... in case of an ApplicationModel
tm
parents:
1761
diff
changeset
|
372 |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
373 |
(usedBuilder := canvas builder) isNil ifTrue:[ |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
374 |
(usedBuilder := oldBuilder) isNil ifTrue:[ |
3516 | 375 |
canvas createBuilder. |
376 |
usedBuilder := canvas builder. |
|
1891
ab8801a1c22d
subapps always got a new builder (even if one was already present)
tm
parents:
1777
diff
changeset
|
377 |
] ifFalse:[ |
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
378 |
canvas builder:usedBuilder. |
1891
ab8801a1c22d
subapps always got a new builder (even if one was already present)
tm
parents:
1777
diff
changeset
|
379 |
]. |
1777
1c09f7e0a18a
set masterApplication ... in case of an ApplicationModel
tm
parents:
1761
diff
changeset
|
380 |
]. |
1c09f7e0a18a
set masterApplication ... in case of an ApplicationModel
tm
parents:
1761
diff
changeset
|
381 |
|
1c09f7e0a18a
set masterApplication ... in case of an ApplicationModel
tm
parents:
1761
diff
changeset
|
382 |
(appl notNil and:[canvas masterApplication isNil]) ifTrue:[ |
1c09f7e0a18a
set masterApplication ... in case of an ApplicationModel
tm
parents:
1761
diff
changeset
|
383 |
canvas masterApplication:appl |
1c09f7e0a18a
set masterApplication ... in case of an ApplicationModel
tm
parents:
1761
diff
changeset
|
384 |
]. |
1943
c90153998d43
set new application in builder if builder is created
martin
parents:
1936
diff
changeset
|
385 |
self createNewBuilder ifTrue:[ |
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
386 |
usedBuilder application:canvas |
1943
c90153998d43
set new application in builder if builder is created
martin
parents:
1936
diff
changeset
|
387 |
]. |
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
388 |
view client:canvas spec:wsel builder:usedBuilder. |
1759 | 389 |
canvas window:(self setupCanvasView:view). |
390 |
] ifFalse:[ |
|
391 |
canvas := self setupCanvasView:canvas |
|
1943
c90153998d43
set new application in builder if builder is created
martin
parents:
1936
diff
changeset
|
392 |
] |
1759 | 393 |
]. |
394 |
^ canvas |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
395 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
396 |
"Modified: / 06-09-2006 / 15:07:55 / cg" |
1759 | 397 |
! |
398 |
||
3436 | 399 |
canvasApplication |
400 |
"returns the application the canvas is running" |
|
401 |
||
402 |
|canvas| |
|
403 |
||
404 |
(canvas := self canvas) isNil ifTrue:[^ nil]. |
|
405 |
(canvas isKindOf:ApplicationModel) ifTrue:[ ^ canvas ]. |
|
406 |
^ canvas application |
|
407 |
! |
|
408 |
||
3347 | 409 |
canvasOrNil |
410 |
"returns the application or nil - does NOT create one" |
|
411 |
||
412 |
^ canvas |
|
413 |
! |
|
414 |
||
1759 | 415 |
canvasView |
416 |
"returns the view the canvas is running in or nil if no canvas |
|
417 |
specified or not yet created |
|
418 |
" |
|
419 |
|canvas| |
|
420 |
||
421 |
(canvas := self canvas) notNil ifTrue:[ |
|
422 |
^ canvas perform:#window ifNotUnderstood:[canvas] |
|
423 |
]. |
|
424 |
^ nil |
|
425 |
! |
|
426 |
||
427 |
destroyCanvas |
|
3268 | 428 |
|canvasView| |
1759 | 429 |
|
430 |
canvas notNil ifTrue:[ |
|
2723 | 431 |
self isCanvasApplicationModel ifTrue:[ |
432 |
canvas releaseAsSubCanvas. |
|
433 |
]. |
|
3268 | 434 |
(canvasView := self canvasView) notNil ifTrue:[ |
435 |
canvasView destroy. |
|
436 |
]. |
|
1759 | 437 |
canvas := nil |
438 |
]. |
|
3268 | 439 |
|
440 |
"Modified: / 02-11-2007 / 14:54:47 / cg" |
|
1759 | 441 |
! |
442 |
||
443 |
majorKey |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
444 |
^ majorKey |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
445 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
446 |
"Modified: / 06-09-2006 / 15:01:14 / cg" |
1759 | 447 |
! |
448 |
||
449 |
majorKey:aMajorKey |
|
450 |
|key| |
|
451 |
||
452 |
aMajorKey notNil ifTrue:[ |
|
453 |
aMajorKey isBehavior ifTrue:[ |
|
454 |
key := aMajorKey name asSymbol |
|
455 |
] ifFalse:[ |
|
456 |
aMajorKey size ~~ 0 ifTrue:[ |
|
457 |
key := aMajorKey asSymbol |
|
458 |
] |
|
459 |
] |
|
460 |
]. |
|
461 |
||
462 |
self majorKey ~~ key ifTrue:[ |
|
463 |
self destroyCanvas |
|
464 |
]. |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
465 |
majorKey := key. |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
466 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
467 |
"Modified: / 06-09-2006 / 15:01:22 / cg" |
1759 | 468 |
! |
469 |
||
470 |
minorKey |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
471 |
^ minorKey |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
472 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
473 |
"Modified: / 06-09-2006 / 15:01:58 / cg" |
1759 | 474 |
! |
475 |
||
476 |
minorKey:aMinorKey |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
477 |
minorKey := aMinorKey. |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
478 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
479 |
"Modified: / 06-09-2006 / 15:02:04 / cg" |
1759 | 480 |
! |
1671 | 481 |
|
1759 | 482 |
setupCanvasView:aView |
3888 | 483 |
|frame isV isH auto viewScroller| |
1759 | 484 |
|
485 |
isH := self hasHorizontalScrollBar. |
|
486 |
isV := self hasVerticalScrollBar. |
|
487 |
||
488 |
(isH or:[isV]) ifFalse:[ |
|
489 |
frame := aView |
|
490 |
] ifTrue:[ |
|
491 |
frame := ScrollableView for:ViewScroller. |
|
3888 | 492 |
viewScroller := frame scrolledView. |
1759 | 493 |
|
494 |
frame horizontalScrollable:isH. |
|
495 |
frame verticalScrollable:isV. |
|
496 |
||
3888 | 497 |
isH ifTrue:[ |
498 |
frame horizontalMini:(self miniScrollerHorizontal) |
|
499 |
] ifFalse:[ |
|
500 |
"/ not horizontal scrollable - always set x to scrolled view x |
|
501 |
viewScroller resizeScrolledViewHorizontal:true. |
|
502 |
]. |
|
503 |
isV ifTrue:[ |
|
504 |
frame verticalMini:(self miniScrollerVertical) |
|
505 |
] ifFalse:[ |
|
506 |
"/ not vertical scrollable - always set y to scrolled view y |
|
507 |
viewScroller resizeScrolledViewVertical:true. |
|
508 |
]. |
|
1759 | 509 |
|
510 |
(auto := self autoHideScrollBars) notNil ifTrue:[ |
|
511 |
frame autoHideScrollBars:auto |
|
512 |
]. |
|
3888 | 513 |
viewScroller scrolledView:aView. |
1759 | 514 |
]. |
515 |
frame objectAttributeAt:#isTabItem put:true. |
|
3436 | 516 |
^ frame |
1759 | 517 |
! ! |
518 |
||
2404 | 519 |
!TabItem methodsFor:'accessing-scrollbars'! |
1759 | 520 |
|
521 |
autoHideScrollBars |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
522 |
^ autoHideScrollBars |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
523 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
524 |
"Modified: / 06-09-2006 / 14:58:38 / cg" |
1759 | 525 |
! |
526 |
||
527 |
autoHideScrollBars:aBoolOrNil |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
528 |
autoHideScrollBars := aBoolOrNil |
1759 | 529 |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
530 |
"Modified: / 06-09-2006 / 14:58:45 / cg" |
1759 | 531 |
! |
532 |
||
533 |
hasHorizontalScrollBar |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
534 |
^ hasHorizontalScrollBar ? false |
1759 | 535 |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
536 |
"Modified: / 06-09-2006 / 15:00:39 / cg" |
1759 | 537 |
! |
538 |
||
539 |
hasHorizontalScrollBar:aBool |
|
540 |
|flag| |
|
541 |
||
542 |
aBool == true ifTrue:[flag := true] |
|
543 |
ifFalse:[self miniScrollerHorizontal:false]. |
|
544 |
||
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
545 |
hasHorizontalScrollBar := flag |
1759 | 546 |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
547 |
"Modified: / 06-09-2006 / 15:00:58 / cg" |
1759 | 548 |
! |
549 |
||
550 |
hasVerticalScrollBar |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
551 |
^ hasVerticalScrollBar ? false |
1759 | 552 |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
553 |
"Modified: / 06-09-2006 / 15:01:03 / cg" |
1759 | 554 |
! |
555 |
||
556 |
hasVerticalScrollBar:aBool |
|
557 |
|flag| |
|
558 |
||
559 |
aBool == true ifTrue:[flag := true] |
|
560 |
ifFalse:[self miniScrollerVertical:false]. |
|
561 |
||
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
562 |
hasVerticalScrollBar := flag |
1759 | 563 |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
564 |
"Modified: / 06-09-2006 / 15:01:10 / cg" |
1759 | 565 |
! |
566 |
||
567 |
miniScrollerHorizontal |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
568 |
^ miniScrollerHorizontal ? false |
1759 | 569 |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
570 |
"Modified: / 06-09-2006 / 15:01:29 / cg" |
1759 | 571 |
! |
572 |
||
573 |
miniScrollerHorizontal:aBool |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
574 |
miniScrollerHorizontal := aBool |
1759 | 575 |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
576 |
"Modified: / 06-09-2006 / 15:01:40 / cg" |
1759 | 577 |
! |
578 |
||
579 |
miniScrollerVertical |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
580 |
^ miniScrollerVertical ? false |
1759 | 581 |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
582 |
"Modified: / 06-09-2006 / 15:01:45 / cg" |
1759 | 583 |
! |
584 |
||
585 |
miniScrollerVertical:aBool |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
586 |
miniScrollerVertical := aBool |
1759 | 587 |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
588 |
"Modified: / 06-09-2006 / 15:01:55 / cg" |
696 | 589 |
! ! |
590 |
||
591 |
!TabItem methodsFor:'building'! |
|
592 |
||
3416
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
593 |
applicationProvidesLabel |
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
594 |
"returns true if the label is aquired from the application" |
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
595 |
|
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
596 |
^ applicationProvidesLabel ? false |
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
597 |
! |
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
598 |
|
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
599 |
applicationProvidesLabel:aBool |
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
600 |
"set/clear the flag which controls if the label is provided by the application" |
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
601 |
|
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
602 |
applicationProvidesLabel := aBool. |
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
603 |
! |
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
604 |
|
716 | 605 |
editAgument |
606 |
"used by TabItemEditor to get the argument |
|
607 |
" |
|
608 |
^ argument isSymbol ifTrue:['#', argument] ifFalse:[argument] |
|
609 |
! |
|
610 |
||
611 |
editAgument:anArgument |
|
612 |
"used by TabItemEditor to set the argument |
|
613 |
" |
|
2439 | 614 |
|size| |
716 | 615 |
|
616 |
anArgument size ~~ 0 ifTrue:[ |
|
617 |
argument := anArgument withoutSeparators. |
|
618 |
||
619 |
(size := argument size) == 0 ifTrue:[ |
|
620 |
argument := nil |
|
621 |
] ifFalse:[ |
|
622 |
(argument startsWith:$#) ifTrue:[ |
|
623 |
size > 1 ifTrue:[ |
|
624 |
argument := (argument copyFrom:2) asSymbol |
|
625 |
] ifFalse:[ |
|
626 |
argument := nil |
|
627 |
] |
|
628 |
] |
|
629 |
] |
|
630 |
] ifFalse:[ |
|
631 |
argument := nil |
|
632 |
] |
|
633 |
! |
|
634 |
||
696 | 635 |
rawLabel |
636 |
"returns the label to be shown |
|
637 |
" |
|
638 |
^ rawLabel ? ' ' |
|
639 |
||
640 |
||
641 |
! |
|
642 |
||
702 | 643 |
setAttributesFromClass:aClass |
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
644 |
"setup attributes from aClass |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
645 |
Ugly: used only with the tabListEditor." |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
646 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
647 |
|spec cls| |
1761 | 648 |
|
649 |
rawLabel := nil. |
|
650 |
||
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
651 |
cls := aClass. |
3887 | 652 |
cls isBehavior ifFalse:[ |
3559 | 653 |
self halt:'please pass a class, not its name as argument'. |
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
654 |
cls := Smalltalk classNamed:aClass |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
655 |
]. |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
656 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
657 |
cls notNil ifTrue:[ |
1761 | 658 |
(self translateLabel and:[label isString]) ifTrue:[ |
659 |
rawLabel := cls perform:(label asSymbol) ifNotUnderstood:nil |
|
702 | 660 |
]. |
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
661 |
(majorKey isNil and:[minorKey notNil]) ifTrue:[ |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
662 |
"/ Error handle:[:ex| |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
663 |
"/ ] do:[ |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
664 |
"/ spec := cls perform:(minorKey asSymbol) ifNotUnderstood:nil. |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
665 |
"/ spec notNil ifTrue:[ |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
666 |
canvas := ApplicationSubView new. |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
667 |
canvas client:nil spec:minorKey "spec" builder:(UIBuilder new). |
1761 | 668 |
canvas := self setupCanvasView:canvas. |
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
669 |
"/ ]. |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
670 |
"/ ] |
1761 | 671 |
] |
702 | 672 |
]. |
1761 | 673 |
|
674 |
rawLabel isNil ifTrue:[ |
|
675 |
rawLabel := label isNil ifTrue:[''] ifFalse:[label printString] |
|
676 |
]. |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
677 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
678 |
"Modified: / 06-09-2006 / 17:48:37 / cg" |
702 | 679 |
! |
680 |
||
696 | 681 |
setAttributesWithBuilder:aBuilder |
3919 | 682 |
"setup attributes dependent on the builder" |
683 |
||
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
684 |
|appl usedBuilder | |
1759 | 685 |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
686 |
usedBuilder := self createNewBuilder ifTrue:[UIBuilder new] ifFalse:[aBuilder]. |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
687 |
builder := usedBuilder. |
1759 | 688 |
|
3416
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
689 |
(self applicationProvidesLabel) ifTrue:[ |
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
690 |
rawLabel := aBuilder labelFor:label. |
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
691 |
] ifFalse:[ |
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
692 |
(self translateLabel) ifTrue:[ |
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
693 |
rawLabel := aBuilder application resources string:label. |
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
694 |
]. |
1759 | 695 |
]. |
696 |
rawLabel isNil ifTrue:[ |
|
697 |
rawLabel := label printString. |
|
696 | 698 |
]. |
1759 | 699 |
|
3919 | 700 |
(aBuilder notNil and:[aBuilder isEditing not]) ifTrue:[ |
701 |
appl := aBuilder application. |
|
702 |
]. |
|
703 |
appl notNil ifTrue:[ |
|
704 |
"/ now lazy - when actually asked for (to allow for more dynamics) |
|
705 |
"/ activeHelpKey notNil ifTrue:[ |
|
706 |
"/ activeHelpText := appl helpTextForKey:activeHelpKey. |
|
707 |
"/ ]. |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
708 |
usedBuilder application isNil ifTrue:[ |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
709 |
usedBuilder application:appl |
1777
1c09f7e0a18a
set masterApplication ... in case of an ApplicationModel
tm
parents:
1761
diff
changeset
|
710 |
]. |
1c09f7e0a18a
set masterApplication ... in case of an ApplicationModel
tm
parents:
1761
diff
changeset
|
711 |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
712 |
(majorKey isNil and:[minorKey notNil]) ifTrue:[ |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
713 |
canvas := ApplicationSubView new. |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
714 |
canvas client:appl spec:minorKey builder:usedBuilder. |
1759 | 715 |
canvas := self setupCanvasView:canvas. |
716 |
] |
|
1891
ab8801a1c22d
subapps always got a new builder (even if one was already present)
tm
parents:
1777
diff
changeset
|
717 |
]. |
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
718 |
|
3919 | 719 |
"Modified: / 25-07-2010 / 11:26:23 / cg" |
696 | 720 |
! |
721 |
||
722 |
translateLabel |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
723 |
"returns true if the label derives from the application" |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
724 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
725 |
^ translateLabel ? false |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
726 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
727 |
"Modified: / 06-09-2006 / 15:09:40 / cg" |
696 | 728 |
! |
729 |
||
730 |
translateLabel:aBool |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
731 |
"set/clear the flag which controls if the label is translated to a national language |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
732 |
via the applications resources" |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
733 |
|
3416
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
734 |
translateLabel := aBool. |
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
735 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
736 |
"Modified: / 06-09-2006 / 15:11:16 / cg" |
696 | 737 |
! ! |
738 |
||
739 |
!TabItem methodsFor:'converting'! |
|
740 |
||
3191 | 741 |
skippedInLiteralEncoding |
742 |
|skipped| |
|
696 | 743 |
|
3191 | 744 |
skipped := super skippedInLiteralEncoding asOrderedCollection. |
696 | 745 |
|
3191 | 746 |
skipped add:#view. |
747 |
skipped add:#rawLabel. |
|
748 |
skipped add:#canvas. |
|
716 | 749 |
|
3191 | 750 |
self enabled ifTrue:[ skipped add:#enabled ]. |
751 |
self accessCharacterPosition == 0 ifTrue:[ skipped add:#accessCharacterPosition ]. |
|
752 |
self createNewBuilder ifTrue:[ skipped add:#createNewBuilder ]. |
|
753 |
self miniScrollerVertical ifFalse:[ skipped add:#miniScrollerVertical ]. |
|
754 |
self miniScrollerHorizontal ifFalse:[ skipped add:#miniScrollerHorizontal ]. |
|
3416
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
755 |
self translateLabel ifFalse:[ skipped add:#translateLabel ]. |
84641e5a108c
confusion between applicationProvidesLabel and translateLabel fixed.
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
756 |
self applicationProvidesLabel ifFalse:[ skipped add:#applicationProvidesLabel ]. |
1759 | 757 |
|
3191 | 758 |
^ skipped |
696 | 759 |
! ! |
760 |
||
1759 | 761 |
!TabItem methodsFor:'displaying'! |
762 |
||
763 |
displayOn:aGC x:x y:y |
|
764 |
|s| |
|
765 |
||
766 |
(s := rawLabel ? label) isNil ifTrue:[ |
|
767 |
^ self |
|
768 |
]. |
|
769 |
s isNumber ifTrue:[ |
|
770 |
s := s printString |
|
771 |
]. |
|
772 |
s displayOn:aGC x:x y:y |
|
773 |
! |
|
774 |
||
775 |
heightOn:aGC |
|
776 |
|s| |
|
777 |
||
778 |
(s := rawLabel ? label) isNil ifTrue:[ |
|
779 |
^ aGC font height |
|
780 |
]. |
|
781 |
^ s heightOn:aGC |
|
782 |
! |
|
783 |
||
784 |
widthOn:aGC |
|
785 |
|s| |
|
786 |
||
787 |
(s := rawLabel ? label) isNil ifTrue:[ |
|
788 |
^ 4 |
|
789 |
]. |
|
790 |
^ s widthOn:aGC |
|
791 |
! ! |
|
792 |
||
793 |
!TabItem methodsFor:'help'! |
|
794 |
||
795 |
activeHelpKey |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
796 |
^ activeHelpKey |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
797 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
798 |
"Modified: / 06-09-2006 / 14:58:11 / cg" |
1759 | 799 |
! |
800 |
||
801 |
activeHelpKey:aKey |
|
802 |
|key| |
|
803 |
||
804 |
aKey size > 0 ifTrue:[key := aKey asSymbol]. |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
805 |
activeHelpKey := key |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
806 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
807 |
"Modified: / 06-09-2006 / 14:58:32 / cg" |
1759 | 808 |
! |
809 |
||
810 |
activeHelpText |
|
3393
8b665bfc7be0
active help etxt done dynamically (when being sked for)
Claus Gittinger <cg@exept.de>
parents:
3358
diff
changeset
|
811 |
|appl| |
8b665bfc7be0
active help etxt done dynamically (when being sked for)
Claus Gittinger <cg@exept.de>
parents:
3358
diff
changeset
|
812 |
|
8b665bfc7be0
active help etxt done dynamically (when being sked for)
Claus Gittinger <cg@exept.de>
parents:
3358
diff
changeset
|
813 |
activeHelpText notNil ifTrue:[^ activeHelpText]. |
8b665bfc7be0
active help etxt done dynamically (when being sked for)
Claus Gittinger <cg@exept.de>
parents:
3358
diff
changeset
|
814 |
|
8b665bfc7be0
active help etxt done dynamically (when being sked for)
Claus Gittinger <cg@exept.de>
parents:
3358
diff
changeset
|
815 |
activeHelpKey notNil ifTrue:[ |
8b665bfc7be0
active help etxt done dynamically (when being sked for)
Claus Gittinger <cg@exept.de>
parents:
3358
diff
changeset
|
816 |
view notNil ifTrue:[ |
8b665bfc7be0
active help etxt done dynamically (when being sked for)
Claus Gittinger <cg@exept.de>
parents:
3358
diff
changeset
|
817 |
appl := view application. |
8b665bfc7be0
active help etxt done dynamically (when being sked for)
Claus Gittinger <cg@exept.de>
parents:
3358
diff
changeset
|
818 |
]. |
8b665bfc7be0
active help etxt done dynamically (when being sked for)
Claus Gittinger <cg@exept.de>
parents:
3358
diff
changeset
|
819 |
appl isNil ifTrue:[ |
8b665bfc7be0
active help etxt done dynamically (when being sked for)
Claus Gittinger <cg@exept.de>
parents:
3358
diff
changeset
|
820 |
builder notNil ifTrue:[ |
8b665bfc7be0
active help etxt done dynamically (when being sked for)
Claus Gittinger <cg@exept.de>
parents:
3358
diff
changeset
|
821 |
appl := builder application. |
8b665bfc7be0
active help etxt done dynamically (when being sked for)
Claus Gittinger <cg@exept.de>
parents:
3358
diff
changeset
|
822 |
]. |
8b665bfc7be0
active help etxt done dynamically (when being sked for)
Claus Gittinger <cg@exept.de>
parents:
3358
diff
changeset
|
823 |
]. |
8b665bfc7be0
active help etxt done dynamically (when being sked for)
Claus Gittinger <cg@exept.de>
parents:
3358
diff
changeset
|
824 |
appl notNil ifTrue:[ |
8b665bfc7be0
active help etxt done dynamically (when being sked for)
Claus Gittinger <cg@exept.de>
parents:
3358
diff
changeset
|
825 |
^ appl flyByHelpTextForKey:activeHelpKey. |
8b665bfc7be0
active help etxt done dynamically (when being sked for)
Claus Gittinger <cg@exept.de>
parents:
3358
diff
changeset
|
826 |
]. |
8b665bfc7be0
active help etxt done dynamically (when being sked for)
Claus Gittinger <cg@exept.de>
parents:
3358
diff
changeset
|
827 |
]. |
8b665bfc7be0
active help etxt done dynamically (when being sked for)
Claus Gittinger <cg@exept.de>
parents:
3358
diff
changeset
|
828 |
|
8b665bfc7be0
active help etxt done dynamically (when being sked for)
Claus Gittinger <cg@exept.de>
parents:
3358
diff
changeset
|
829 |
^ nil |
8b665bfc7be0
active help etxt done dynamically (when being sked for)
Claus Gittinger <cg@exept.de>
parents:
3358
diff
changeset
|
830 |
! |
8b665bfc7be0
active help etxt done dynamically (when being sked for)
Claus Gittinger <cg@exept.de>
parents:
3358
diff
changeset
|
831 |
|
8b665bfc7be0
active help etxt done dynamically (when being sked for)
Claus Gittinger <cg@exept.de>
parents:
3358
diff
changeset
|
832 |
activeHelpText:aString |
8b665bfc7be0
active help etxt done dynamically (when being sked for)
Claus Gittinger <cg@exept.de>
parents:
3358
diff
changeset
|
833 |
activeHelpText := aString |
1759 | 834 |
! ! |
835 |
||
836 |
!TabItem methodsFor:'queries'! |
|
696 | 837 |
|
2723 | 838 |
isCanvasApplicationModel |
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
839 |
"returns true if the canvas is an application model" |
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
840 |
|
2723 | 841 |
canvas notNil ifTrue:[ |
842 |
^ canvas isKindOf:ApplicationModel. |
|
843 |
]. |
|
844 |
^ false. |
|
3068
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
845 |
|
ae56b8c3c7a6
that code sucked - it still does, but less so.
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
846 |
"Modified: / 06-09-2006 / 15:11:50 / cg" |
2723 | 847 |
! |
848 |
||
696 | 849 |
isEnabled |
850 |
^ self enabled |
|
851 |
! ! |
|
852 |
||
853 |
!TabItem class methodsFor:'documentation'! |
|
854 |
||
855 |
version |
|
3933 | 856 |
^ '$Header: /cvs/stx/stx/libwidg2/TabItem.st,v 1.37 2010-09-21 14:59:04 cg Exp $' |
3887 | 857 |
! |
858 |
||
859 |
version_CVS |
|
3933 | 860 |
^ '$Header: /cvs/stx/stx/libwidg2/TabItem.st,v 1.37 2010-09-21 14:59:04 cg Exp $' |
696 | 861 |
! ! |