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