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