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