author | Claus Gittinger <cg@exept.de> |
Tue, 15 Sep 2009 20:15:42 +0200 | |
changeset 3911 | 2e2c5429a2f9 |
parent 3903 | e18c6e99186e |
child 3966 | e720fae69860 |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
59 | 3 |
All Rights Reserved |
0 | 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 |
" |
|
2258 | 12 |
"{ Package: 'stx:libwidg' }" |
13 |
||
0 | 14 |
SelectionInListView subclass:#MenuView |
2498 | 15 |
instanceVariableNames:'selectors args receiver enableFlags disabledFgColor |
16 |
disabledEtchedFgColor onOffFlags subMenus subMenuShown superMenu |
|
17 |
checkColor lineLevel lineInset masterView needResize |
|
18 |
hideOnRelease sizeFixed shortKeys maxShortKeyStringLen actions |
|
19 |
checkOnImage checkOffImage' |
|
405
39b9b0f04ccc
allow checkmarks at any position
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
20 |
classVariableNames:'DefaultCheckColor DefaultViewBackground DefaultForegroundColor |
39b9b0f04ccc
allow checkmarks at any position
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
21 |
DefaultBackgroundColor DefaultDisabledForegroundColor |
2498 | 22 |
DefaultDisabledEtchedForegroundColor |
405
39b9b0f04ccc
allow checkmarks at any position
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
23 |
DefaultHilightForegroundColor DefaultHilightBackgroundColor |
39b9b0f04ccc
allow checkmarks at any position
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
24 |
DefaultHilightLevel DefaultHilightStyle DefaultHilightFrameColor |
39b9b0f04ccc
allow checkmarks at any position
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
25 |
DefaultLineLevel DefaultLineInset DefaultShadowColor |
1532 | 26 |
DefaultLightColor ShowAcceleratorKeys DefaultCheckOnImage |
27 |
DefaultCheckOffImage' |
|
269 | 28 |
poolDictionaries:'' |
29 |
category:'Views-Menus' |
|
0 | 30 |
! |
31 |
||
878 | 32 |
!MenuView class methodsFor:'documentation'! |
3 | 33 |
|
38 | 34 |
copyright |
35 |
" |
|
36 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
59 | 37 |
All Rights Reserved |
38 | 38 |
|
39 |
This software is furnished under a license and may be used |
|
40 |
only in accordance with the terms of that license and with the |
|
41 |
inclusion of the above copyright notice. This software may not |
|
42 |
be provided or otherwise made available to, or used by, any |
|
43 |
other person. No title to or ownership of the software is |
|
44 |
hereby transferred. |
|
45 |
" |
|
46 |
! |
|
47 |
||
3 | 48 |
documentation |
49 |
" |
|
1532 | 50 |
Notice: |
2498 | 51 |
MenuView is going to be obsoleted - use Menu & MenuItem, |
52 |
and display them in a MenuPanel for new applications. |
|
1532 | 53 |
|
63 | 54 |
a menu view used for both pull-down-menus and pop-up-menus (and also, |
831
8af010be0a02
Rename Launcher-->OldLauncher, NewLauncher-->Launcher.
Stefan Vogel <sv@exept.de>
parents:
799
diff
changeset
|
55 |
for nonModal menus, such as the OldLaunchers click-menu). |
38 | 56 |
the action to be performed can be defined either as: |
0 | 57 |
|
38 | 58 |
1) action:aBlockWithOneArg |
59 |
which defines a block to be called with the line number (1..n) |
|
60 |
of the selected line. |
|
0 | 61 |
|
119 | 62 |
2) selectors:selectorArray [args: argArray] [receiver:anObject] |
63 |
which defines the messages to be sent to the model or |
|
64 |
receiver. Giving an explicit receiver overrides the model. |
|
0 | 65 |
|
38 | 66 |
It is also possible to define both actionBlock and selectorArray. |
0 | 67 |
|
63 | 68 |
The wellknown popups are created by wrapping a MenuView into an instance of |
69 |
PopUpMenu (read the description of popupmenu). |
|
70 |
||
38 | 71 |
menu entries starting with '\c' are check-entries. |
131 | 72 |
menu entries starting with '\b' are checkBox-entries. |
73 |
menu entries starting with '\t' are thumbUp/Down-entries. |
|
38 | 74 |
menu entries conisting of '-' alone, are separating lines. |
63 | 75 |
menu entries conisting of '=' alone, are double separating lines. |
130 | 76 |
|
77 |
||
78 |
StyleSheet defaults: |
|
79 |
||
1532 | 80 |
menuFont font to use for menus |
81 |
||
82 |
menuViewBackground view background (should be same as menuBackgroundColor) |
|
83 |
menuForegroundColor foreground color |
|
84 |
menuBackgroundColor background color |
|
85 |
||
86 |
menuShadowColor shadow color for 3D effects |
|
87 |
menuLightColor lightColor for 3D effects |
|
88 |
menuHilightForegroundColor hilighted items foregroundColor |
|
89 |
menuHilightBackgroundColor hilighted items backgroundColor |
|
90 |
||
91 |
menuHilightFrameColor frame arounf hilighted items (or nil, if none) |
|
92 |
defaults to selectionHilightFrameColor |
|
93 |
menuHilightLevel 3D level of selected items |
|
94 |
menuHilightStyle #openwin or nil (special kludge) |
|
95 |
menuSeparatingLineLevel 3D level of sep. lines |
|
96 |
menuSeparatingLineInset left/right inset of sep. lines |
|
97 |
menuDisabledForegroundColor foreground color of disabled items |
|
98 |
menuCheckColor color to use for check marks |
|
99 |
menuFont font to use |
|
130 | 100 |
|
101 |
other values and some defaults are inherited via SelectionInListViews |
|
102 |
styles (i.e. look for selectionForegroundColor ...) |
|
586 | 103 |
|
104 |
[author:] |
|
1532 | 105 |
Claus Gittinger |
593 | 106 |
|
107 |
[see also:] |
|
1532 | 108 |
PopUpMenu PullDownMenu |
109 |
ClickMenuView |
|
110 |
LineMenu PatternMenu |
|
63 | 111 |
" |
112 |
! |
|
21 | 113 |
|
63 | 114 |
examples |
115 |
" |
|
405
39b9b0f04ccc
allow checkmarks at any position
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
116 |
See real examples in PopUpMenu & PullDownMenu |
39b9b0f04ccc
allow checkmarks at any position
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
117 |
|
45 | 118 |
Examples: |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
119 |
Notice: normally, menuviews are wrapped into either a popup- |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
120 |
menu or pulldown-menu. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
121 |
But they can also be used stand-alone as in the following examples: |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
122 |
|
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
123 |
[exBegin] |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
124 |
|m| |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
125 |
m := MenuView |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
126 |
labels:#('foo' |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
127 |
'bar' |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
128 |
'baz') |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
129 |
selectors:#( |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
130 |
#foo |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
131 |
#bar |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
132 |
#baz) |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
133 |
receiver:nil. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
134 |
m open |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
135 |
[exEnd] |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
136 |
|
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
137 |
[exBegin] |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
138 |
|m| |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
139 |
m := MenuView |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
140 |
labels:#('foo' |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
141 |
'bar' |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
142 |
'baz') |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
143 |
selectors:#foo: |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
144 |
args:#(1 2 3) |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
145 |
receiver:nil. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
146 |
m open |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
147 |
[exEnd] |
3 | 148 |
" |
202 | 149 |
! ! |
150 |
||
878 | 151 |
!MenuView class methodsFor:'instance creation'! |
202 | 152 |
|
748 | 153 |
forMenu:aTopMenu |
154 |
"create and return a new menuView, which will be contained in |
|
155 |
aTopMenus superView" |
|
156 |
||
157 |
aTopMenu isNil ifTrue:[ |
|
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
158 |
^ self new |
748 | 159 |
]. |
160 |
^ self in:(aTopMenu superView). |
|
161 |
||
162 |
"Created: 5.6.1996 / 11:29:27 / cg" |
|
163 |
! |
|
164 |
||
202 | 165 |
labels:labels |
166 |
"create and return a new MenuView. The parent view, |
|
167 |
selectors and receiver should be set later." |
|
168 |
||
169 |
^ self labels:labels selectors:nil args:nil receiver:nil |
|
170 |
! |
|
171 |
||
172 |
labels:labels selector:aSelector args:argArray receiver:anObject for:aTopMenu |
|
173 |
"create and return a new MenuView |
|
174 |
- receiverObject gets message aSelector with argument from |
|
175 |
argArray for ALL entries" |
|
176 |
||
177 |
"OBSOLETE protocol: labels:selectors:args:receiver: knows how to handle a |
|
178 |
single symbol-arg for selectors ..." |
|
179 |
||
180 |
^ self labels:labels selectors:aSelector args:argArray receiver:anObject in:(aTopMenu superView) |
|
181 |
! |
|
182 |
||
183 |
labels:labels selector:aSelector args:argArray receiver:anObject in:aTopMenu |
|
184 |
"create and return a new MenuView |
|
185 |
- receiverObject gets message aSelector with argument from |
|
186 |
argArray for all entries" |
|
187 |
||
188 |
"OBSOLETE protocol: labels:selectors:args:receiver: knows how to handle a |
|
189 |
single symbol-arg for selectors ..." |
|
190 |
||
191 |
^ self labels:labels selectors:aSelector args:argArray receiver:anObject in:aTopMenu |
|
192 |
! |
|
193 |
||
194 |
labels:labels selectors:selArray |
|
195 |
"create and return a new MenuView. The parent veiw |
|
196 |
and receiver should be set later." |
|
197 |
||
198 |
^ self labels:labels selectors:selArray args:nil receiver:nil |
|
199 |
! |
|
200 |
||
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
201 |
labels:labels selectors:selArray accelerators:shorties |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
202 |
"create and return a new MenuView. The parent veiw |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
203 |
and receiver should be set later." |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
204 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
205 |
^ self labels:labels selectors:selArray accelerators:shorties args:nil receiver:nil |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
206 |
! |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
207 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
208 |
labels:labels selectors:selArray accelerators:shorties args:argArray receiver:anObject |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
209 |
"create and return a new MenuView. The parent view |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
210 |
should be set later." |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
211 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
212 |
^ (self new) |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
213 |
labels:labels |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
214 |
selectors:selArray |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
215 |
accelerators:shorties |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
216 |
args:argArray |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
217 |
receiver:anObject |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
218 |
! |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
219 |
|
750 | 220 |
labels:labels selectors:selArray accelerators:shorties args:argArray receiver:anObject for:aTopMenu |
221 |
"create and return a new MenuView for a topMenu" |
|
222 |
||
223 |
^ self labels:labels selectors:selArray accelerators:shorties args:argArray receiver:anObject in:(aTopMenu superView) |
|
224 |
||
225 |
"Created: 5.6.1996 / 16:51:46 / cg" |
|
226 |
! |
|
227 |
||
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
228 |
labels:labels selectors:selArray accelerators:shorties args:argArray receiver:anObject in:aView |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
229 |
"create and return a new MenuView in aView |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
230 |
- receiverObject gets message from selectorArray with argument |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
231 |
from argArray" |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
232 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
233 |
^ (self in:aView) |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
234 |
labels:labels |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
235 |
selectors:selArray |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
236 |
accelerators:shorties |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
237 |
args:argArray |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
238 |
receiver:anObject |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
239 |
! |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
240 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
241 |
labels:labels selectors:selArray accelerators:shorties receiver:anObject |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
242 |
"create and return a new MenuView. The parent view |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
243 |
should be set later." |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
244 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
245 |
^ self labels:labels selectors:selArray accelerators:shorties args:nil receiver:anObject |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
246 |
! |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
247 |
|
202 | 248 |
labels:labels selectors:selArray args:argArray |
249 |
"create and return a new MenuView. The parent view |
|
250 |
should be set later." |
|
251 |
||
252 |
^ self labels:labels selectors:selArray args:argArray |
|
253 |
! |
|
254 |
||
255 |
labels:labels selectors:selArray args:argArray receiver:anObject |
|
256 |
"create and return a new MenuView. The parent view |
|
257 |
should be set later." |
|
258 |
||
259 |
^ (self new) |
|
260 |
labels:labels |
|
261 |
selectors:selArray |
|
262 |
args:argArray |
|
263 |
receiver:anObject |
|
264 |
! |
|
265 |
||
266 |
labels:labels selectors:selArray args:argArray receiver:anObject for:aTopMenu |
|
267 |
"create and return a new MenuView for a topMenu" |
|
268 |
||
269 |
^ self labels:labels selectors:selArray args:argArray receiver:anObject in:(aTopMenu superView) |
|
270 |
! |
|
271 |
||
272 |
labels:labels selectors:selArray args:argArray receiver:anObject in:aView |
|
273 |
"create and return a new MenuView in aView |
|
274 |
- receiverObject gets message from selectorArray with argument |
|
275 |
from argArray" |
|
276 |
||
277 |
^ (self in:aView) |
|
278 |
labels:labels |
|
279 |
selectors:selArray |
|
280 |
args:argArray |
|
281 |
receiver:anObject |
|
282 |
! |
|
283 |
||
284 |
labels:labels selectors:selArray receiver:anObject |
|
285 |
"create and return a new MenuView. The parent view |
|
286 |
should be set later." |
|
287 |
||
288 |
^ self labels:labels selectors:selArray args:nil receiver:anObject |
|
289 |
! |
|
290 |
||
291 |
labels:labels selectors:selArray receiver:anObject for:aTopMenu |
|
292 |
^ self labels:labels selectors:selArray args:nil receiver:anObject for:aTopMenu |
|
293 |
! |
|
294 |
||
295 |
labels:labels selectors:selArray receiver:anObject in:aView |
|
296 |
"create and return a new MenuView in aView |
|
297 |
- receiverObject gets message from selectorArray without argument" |
|
298 |
||
299 |
^ self labels:labels selectors:selArray args:nil receiver:anObject in:aView |
|
3 | 300 |
! ! |
0 | 301 |
|
878 | 302 |
!MenuView class methodsFor:'defaults'! |
59 | 303 |
|
461
45282807f7fa
handle shortKey & submenu-arrow in one line; allow turning of of accelerator display
Claus Gittinger <cg@exept.de>
parents:
460
diff
changeset
|
304 |
showAcceleratorKeys |
45282807f7fa
handle shortKey & submenu-arrow in one line; allow turning of of accelerator display
Claus Gittinger <cg@exept.de>
parents:
460
diff
changeset
|
305 |
^ ShowAcceleratorKeys ~~ false |
45282807f7fa
handle shortKey & submenu-arrow in one line; allow turning of of accelerator display
Claus Gittinger <cg@exept.de>
parents:
460
diff
changeset
|
306 |
|
45282807f7fa
handle shortKey & submenu-arrow in one line; allow turning of of accelerator display
Claus Gittinger <cg@exept.de>
parents:
460
diff
changeset
|
307 |
"Created: 2.3.1996 / 14:52:34 / cg" |
45282807f7fa
handle shortKey & submenu-arrow in one line; allow turning of of accelerator display
Claus Gittinger <cg@exept.de>
parents:
460
diff
changeset
|
308 |
"Modified: 2.3.1996 / 14:54:58 / cg" |
45282807f7fa
handle shortKey & submenu-arrow in one line; allow turning of of accelerator display
Claus Gittinger <cg@exept.de>
parents:
460
diff
changeset
|
309 |
! |
45282807f7fa
handle shortKey & submenu-arrow in one line; allow turning of of accelerator display
Claus Gittinger <cg@exept.de>
parents:
460
diff
changeset
|
310 |
|
45282807f7fa
handle shortKey & submenu-arrow in one line; allow turning of of accelerator display
Claus Gittinger <cg@exept.de>
parents:
460
diff
changeset
|
311 |
showAcceleratorKeys:aBoolean |
45282807f7fa
handle shortKey & submenu-arrow in one line; allow turning of of accelerator display
Claus Gittinger <cg@exept.de>
parents:
460
diff
changeset
|
312 |
ShowAcceleratorKeys := aBoolean |
45282807f7fa
handle shortKey & submenu-arrow in one line; allow turning of of accelerator display
Claus Gittinger <cg@exept.de>
parents:
460
diff
changeset
|
313 |
|
45282807f7fa
handle shortKey & submenu-arrow in one line; allow turning of of accelerator display
Claus Gittinger <cg@exept.de>
parents:
460
diff
changeset
|
314 |
"Created: 2.3.1996 / 14:52:43 / cg" |
45282807f7fa
handle shortKey & submenu-arrow in one line; allow turning of of accelerator display
Claus Gittinger <cg@exept.de>
parents:
460
diff
changeset
|
315 |
! |
45282807f7fa
handle shortKey & submenu-arrow in one line; allow turning of of accelerator display
Claus Gittinger <cg@exept.de>
parents:
460
diff
changeset
|
316 |
|
59 | 317 |
updateStyleCache |
445
f4c4d5c1be6b
parse style-resource directive
Claus Gittinger <cg@exept.de>
parents:
435
diff
changeset
|
318 |
"extract values from the styleSheet and cache them in class variables" |
f4c4d5c1be6b
parse style-resource directive
Claus Gittinger <cg@exept.de>
parents:
435
diff
changeset
|
319 |
|
2584
60387225f33c
disabledBGColor-from styleSheet fix
Claus Gittinger <cg@exept.de>
parents:
2575
diff
changeset
|
320 |
<resource: #style (#'menu.foregroundColor' #'menu.backgroundColor' |
1532 | 321 |
#'menu.viewBackground' |
2584
60387225f33c
disabledBGColor-from styleSheet fix
Claus Gittinger <cg@exept.de>
parents:
2575
diff
changeset
|
322 |
#'menu.shadowColor' #'menu.lightColor' |
1532 | 323 |
#'menu.hilightForegroundColor' #'menu.hilightBackgroundColor' |
2584
60387225f33c
disabledBGColor-from styleSheet fix
Claus Gittinger <cg@exept.de>
parents:
2575
diff
changeset
|
324 |
#'menu.hilightFrameColor' #'selection.hilightFrameColor' |
60387225f33c
disabledBGColor-from styleSheet fix
Claus Gittinger <cg@exept.de>
parents:
2575
diff
changeset
|
325 |
#'menu.hilightLevel' #'menu.hilightStyle' |
1532 | 326 |
#'menu.separatingLineLevel' #'menu.separatingLineInset' |
327 |
#'menu.disabledForegroundColor' |
|
328 |
#'menu.checkColor' #'menu.checkOnImage' #'menu.checkOffImage' |
|
329 |
#'menu.font' #'menu.showAccelerators')> |
|
1356 | 330 |
|
1870 | 331 |
DefaultViewBackground := StyleSheet colorAt:#'menu.viewBackground'. |
332 |
DefaultForegroundColor := StyleSheet colorAt:#'menu.foregroundColor'. |
|
333 |
DefaultBackgroundColor := StyleSheet colorAt:#'menu.backgroundColor'. |
|
334 |
DefaultShadowColor := StyleSheet colorAt:#'menu.shadowColor'. |
|
335 |
DefaultLightColor := StyleSheet colorAt:#'menu.lightColor'. |
|
336 |
DefaultHilightForegroundColor := StyleSheet colorAt:#'menu.hilightForegroundColor'. |
|
337 |
DefaultHilightBackgroundColor := StyleSheet colorAt:#'menu.hilightBackgroundColor'. |
|
338 |
DefaultHilightFrameColor := StyleSheet colorAt:#'menu.hilightFrameColor' |
|
339 |
default:(StyleSheet colorAt:#'selection.hilightFrameColor'). |
|
340 |
DefaultHilightLevel := StyleSheet at:#'menu.hilightLevel'. |
|
341 |
DefaultHilightStyle := StyleSheet at:#'menu.hilightStyle'. |
|
342 |
DefaultLineLevel := StyleSheet at:#'menu.separatingLineLevel'. |
|
343 |
DefaultLineInset := StyleSheet at:#'menu.separatingLineInset'. |
|
2584
60387225f33c
disabledBGColor-from styleSheet fix
Claus Gittinger <cg@exept.de>
parents:
2575
diff
changeset
|
344 |
DefaultDisabledForegroundColor := StyleSheet colorAt:#'menu.disabledForegroundColor' default:nil. |
60387225f33c
disabledBGColor-from styleSheet fix
Claus Gittinger <cg@exept.de>
parents:
2575
diff
changeset
|
345 |
DefaultDisabledForegroundColor isNil ifTrue:[ |
60387225f33c
disabledBGColor-from styleSheet fix
Claus Gittinger <cg@exept.de>
parents:
2575
diff
changeset
|
346 |
DefaultDisabledForegroundColor := StyleSheet colorAt:#'selection.disabledForegroundColor' default:Color darkGray. |
60387225f33c
disabledBGColor-from styleSheet fix
Claus Gittinger <cg@exept.de>
parents:
2575
diff
changeset
|
347 |
DefaultDisabledForegroundColor isNil ifTrue:[ |
60387225f33c
disabledBGColor-from styleSheet fix
Claus Gittinger <cg@exept.de>
parents:
2575
diff
changeset
|
348 |
DefaultDisabledForegroundColor := StyleSheet colorAt:#'button.disabledForegroundColor' default:Color darkGray. |
60387225f33c
disabledBGColor-from styleSheet fix
Claus Gittinger <cg@exept.de>
parents:
2575
diff
changeset
|
349 |
] |
60387225f33c
disabledBGColor-from styleSheet fix
Claus Gittinger <cg@exept.de>
parents:
2575
diff
changeset
|
350 |
]. |
2498 | 351 |
DefaultDisabledEtchedForegroundColor := StyleSheet colorAt:#'menu.disabledEtchedForegroundColor'. |
352 |
DefaultDisabledEtchedForegroundColor isNil ifTrue:[ |
|
353 |
DefaultDisabledEtchedForegroundColor := StyleSheet colorAt:#'button.disabledEtchedForegroundColor'. |
|
354 |
]. |
|
1870 | 355 |
DefaultCheckColor := StyleSheet colorAt:#'menu.checkColor'. |
356 |
DefaultCheckOnImage := StyleSheet at:#'menu.checkOnImage'. |
|
357 |
DefaultCheckOffImage := StyleSheet at:#'menu.checkOffImage'. |
|
358 |
DefaultFont := StyleSheet fontAt:#'menu.font'. |
|
359 |
ShowAcceleratorKeys := StyleSheet at:#'menu.showAccelerators' default:true. |
|
1356 | 360 |
|
1375 | 361 |
" |
362 |
self updateStyleCache |
|
363 |
" |
|
364 |
||
1532 | 365 |
"Modified: / 19.5.1998 / 22:02:30 / cg" |
0 | 366 |
! ! |
367 |
||
136 | 368 |
!MenuView methodsFor:'accessing-behavior'! |
369 |
||
687 | 370 |
action |
371 |
^ actionBlock |
|
372 |
||
373 |
"Created: 25.5.1996 / 15:11:51 / cg" |
|
374 |
! |
|
375 |
||
136 | 376 |
disable:indexOrName |
377 |
"disable an entry" |
|
378 |
||
379 |
self setEnable:indexOrName to:false |
|
380 |
! |
|
381 |
||
269 | 382 |
disableAll |
383 |
"disable all entries" |
|
384 |
||
385 |
self disableAll:selectors |
|
386 |
||
387 |
"Created: 23.12.1995 / 16:56:05 / cg" |
|
388 |
! |
|
389 |
||
136 | 390 |
disableAll:collectionOfIndicesOrNames |
391 |
"disable an collection of entries" |
|
392 |
||
393 |
collectionOfIndicesOrNames do:[:entry | |
|
394 |
self disable:entry |
|
395 |
] |
|
396 |
! |
|
397 |
||
202 | 398 |
enable:indexOrName |
399 |
"enable an entry" |
|
400 |
||
401 |
self setEnable:indexOrName to:true |
|
402 |
! |
|
403 |
||
136 | 404 |
enableAll:collectionOfIndicesOrNames |
405 |
"enable an collection of entries" |
|
406 |
||
407 |
collectionOfIndicesOrNames do:[:entry | |
|
408 |
self enable:entry |
|
409 |
] |
|
410 |
! |
|
411 |
||
202 | 412 |
hideOnRelease:aBoolean |
413 |
hideOnRelease := aBoolean |
|
414 |
! |
|
415 |
||
136 | 416 |
isEnabled:indexOrName |
1033 | 417 |
"return true, if the item at anIndexOrName is enabled" |
418 |
||
136 | 419 |
|index| |
420 |
||
421 |
index := self indexOf:indexOrName. |
|
422 |
index ~~ 0 ifTrue:[ |
|
2433 | 423 |
enableFlags isNil ifTrue:[^ true]. |
424 |
^ enableFlags at:index |
|
136 | 425 |
]. |
426 |
"ask submenus for convenience" |
|
427 |
(indexOrName isNumber not and:[subMenus notNil]) ifTrue:[ |
|
2433 | 428 |
subMenus do:[:m | |
429 |
m notNil ifTrue:[ |
|
430 |
(m isEnabled:indexOrName) ifTrue:[^ true]. |
|
431 |
] |
|
432 |
] |
|
433 |
]. |
|
434 |
^ false |
|
136 | 435 |
! |
436 |
||
437 |
setEnable:indexOrName to:aBoolean |
|
438 |
"enable/disable an entry" |
|
439 |
||
440 |
|index| |
|
441 |
||
442 |
index := self indexOf:indexOrName. |
|
443 |
index ~~ 0 ifTrue:[ |
|
444 |
(enableFlags at:index) ~~ aBoolean ifTrue:[ |
|
445 |
enableFlags at:index put:aBoolean. |
|
446 |
shown ifTrue:[ |
|
447 |
self redrawLine:index |
|
448 |
] |
|
449 |
] |
|
450 |
] ifFalse:[ |
|
451 |
"try submenus for convenience" |
|
452 |
(indexOrName isNumber not and:[subMenus notNil]) ifTrue:[ |
|
453 |
subMenus do:[:m | |
|
454 |
m notNil ifTrue:[ |
|
455 |
m setEnable:indexOrName to:aBoolean |
|
456 |
] |
|
457 |
] |
|
458 |
] |
|
459 |
] |
|
460 |
! ! |
|
461 |
||
462 |
!MenuView methodsFor:'accessing-items'! |
|
7 | 463 |
|
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
464 |
accelerators:collectionOfShortKeys |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
465 |
"set the accelerator keys collection. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
466 |
You should pass translated symbolic keys - the menu will automatically |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
467 |
show the untranslated original key sequences." |
0 | 468 |
|
604
04f04206a2fc
also copy selectors, args & shortKeys
Claus Gittinger <cg@exept.de>
parents:
603
diff
changeset
|
469 |
shortKeys := collectionOfShortKeys copy. |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
470 |
maxShortKeyStringLen := nil. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
471 |
shown ifTrue:[ |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
472 |
self resize |
0 | 473 |
] ifFalse:[ |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
474 |
needResize := true |
0 | 475 |
]. |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
476 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
477 |
"Created: 28.2.1996 / 17:15:31 / cg" |
604
04f04206a2fc
also copy selectors, args & shortKeys
Claus Gittinger <cg@exept.de>
parents:
603
diff
changeset
|
478 |
"Modified: 30.4.1996 / 15:55:14 / cg" |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
479 |
! |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
480 |
|
517
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
481 |
actionAt:indexOrName |
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
482 |
"return an individual action" |
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
483 |
|
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
484 |
|i| |
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
485 |
|
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
486 |
i := self indexOf:indexOrName. |
878 | 487 |
(actions notNil and:[i ~~ 0]) ifTrue:[^ actions at:i ifAbsent:nil]. |
517
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
488 |
^ nil |
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
489 |
|
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
490 |
"Created: 24.3.1996 / 17:17:22 / cg" |
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
491 |
! |
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
492 |
|
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
493 |
actionAt:indexOrName put:aBlock |
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
494 |
"set an individual action" |
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
495 |
|
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
496 |
|i| |
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
497 |
|
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
498 |
i := self indexOf:indexOrName. |
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
499 |
i ~~ 0 ifTrue:[ |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
500 |
actions isNil ifTrue:[ |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
501 |
actions := OrderedCollection new. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
502 |
]. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
503 |
i > actions size ifTrue:[ |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
504 |
actions grow:i |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
505 |
]. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
506 |
actions at:i put:aBlock |
517
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
507 |
] |
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
508 |
|
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
509 |
"Created: 24.3.1996 / 17:18:15 / cg" |
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
510 |
! |
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
511 |
|
774 | 512 |
actions:aCollectionOfActionBlocks |
513 |
"set all actions" |
|
514 |
||
515 |
actions := aCollectionOfActionBlocks |
|
516 |
||
517 |
"Created: 5.7.1996 / 11:33:09 / cg" |
|
518 |
! |
|
519 |
||
2868 | 520 |
addItemList:list after:itemNameOrSelector |
2923
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
521 |
self addItemList:list resources:nil after:itemNameOrSelector |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
522 |
! |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
523 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
524 |
addItemList:list resources:resources after:itemNameOrSelector |
2868 | 525 |
self |
526 |
addLabels:(list collect:[:row | row at:1]) |
|
527 |
selectors:(list collect:[:row | row at:2 ifAbsent:nil]) |
|
528 |
accelerators:(list collect:[:row | row at:3 ifAbsent:nil]) |
|
2923
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
529 |
resources:resources |
2868 | 530 |
after:itemNameOrSelector |
531 |
! |
|
532 |
||
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
533 |
addLabel:aLabel selector:aSelector |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
534 |
"add another label/selector pair at the end" |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
535 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
536 |
self addLabel:aLabel selector:aSelector after:nil |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
537 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
538 |
"Modified: 28.2.1996 / 17:54:11 / cg" |
0 | 539 |
! |
540 |
||
38 | 541 |
addLabel:aLabel selector:aSelector after:aLabelOrSelectorOrNumber |
542 |
"insert another label/selector pair at some place. |
|
543 |
Being very friendly here, allowing label-string, selector or numeric |
|
95 | 544 |
index for the argument aLabelOrSelectorOrNumber. |
545 |
||
546 |
To be independent of the entries label, we recommend you use the selector |
|
547 |
as index; in systems which translate strings for national variants, |
|
548 |
this makes your code easier to maintain." |
|
549 |
||
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
550 |
self |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
551 |
addLabels:(Array with:aLabel) |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
552 |
selectors:(Array with:aSelector) |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
553 |
after:aLabelOrSelectorOrNumber |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
554 |
|
95 | 555 |
" |
556 |
|v1 v2 v3 v4| |
|
557 |
||
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
558 |
v1 := CodeView new open. |
95 | 559 |
|
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
560 |
v2 := CodeView new open. |
119 | 561 |
v2 middleButtonMenu: |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
562 |
(v2 editMenu addLabel:'new entry' selector:#foo after:#pasteSelection; yourself). |
95 | 563 |
|
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
564 |
v3 := CodeView new open. |
119 | 565 |
v3 middleButtonMenu: |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
566 |
(v3 editMenu addLabel:'new entry' selector:#foo after:#others; yourself). |
95 | 567 |
|
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
568 |
v4 := CodeView new open. |
119 | 569 |
v4 middleButtonMenu: |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
570 |
(v4 editMenu addLabel:'new entry' selector:#foo after:1; yourself). |
119 | 571 |
" |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
572 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
573 |
"Modified: 28.2.1996 / 18:04:35 / cg" |
119 | 574 |
! |
575 |
||
202 | 576 |
addLabel:aLabel selector:aSelector arg:anArg |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
577 |
"add another label/selector/argument trio. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
578 |
OBSOLETE" |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
579 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
580 |
|idx| |
202 | 581 |
|
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
582 |
idx := list size + 1. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
583 |
self addLabel:aLabel selector:aSelector. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
584 |
args at:idx put:anArg |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
585 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
586 |
"Modified: 28.2.1996 / 18:08:39 / cg" |
202 | 587 |
! |
588 |
||
589 |
addLabel:aLabel selector:aSelector before:aLabelOrSelectorOrNumber |
|
590 |
"insert another label/selector pair at some place. |
|
591 |
Being very friendly here, allowing label-string, selector or numeric |
|
592 |
index for the argument aLabelOrSelectorOrNumber. |
|
593 |
||
594 |
To be independent of the entries label, we recommend you use the selector |
|
595 |
as index; in systems which translate strings for national variants, |
|
596 |
this makes your code easier to maintain." |
|
597 |
||
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
598 |
self |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
599 |
addLabels:(Array with:aLabel) |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
600 |
selectors:(Array with:aSelector) |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
601 |
before:aLabelOrSelectorOrNumber |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
602 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
603 |
" |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
604 |
|v1 v2 v3 v4 v5| |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
605 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
606 |
v1 := CodeView new open. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
607 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
608 |
v2 := CodeView new open. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
609 |
v2 middleButtonMenu: |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
610 |
(v2 editMenu addLabel:'new entry' selector:#foo before:'paste'; yourself). |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
611 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
612 |
v3 := CodeView new open. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
613 |
v3 middleButtonMenu: |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
614 |
(v3 editMenu addLabel:'new entry' selector:#foo before:#pasteOrReplace; yourself). |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
615 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
616 |
v4 := CodeView new open. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
617 |
v4 middleButtonMenu: |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
618 |
(v4 editMenu addLabel:'new entry' selector:#foo before:#again; yourself). |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
619 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
620 |
v5 := CodeView new open. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
621 |
v5 middleButtonMenu: |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
622 |
(v5 editMenu addLabel:'new entry' selector:#foo before:1; yourself). |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
623 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
624 |
Notice: v2 above is an example on how NOT to do it - it will not work with nationalized menus |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
625 |
" |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
626 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
627 |
"Modified: 28.2.1996 / 18:04:00 / cg" |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
628 |
! |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
629 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
630 |
addLabels:moreLabels selectors:moreSelectors |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
631 |
"add more labels and selectors at the END" |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
632 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
633 |
self addLabels:moreLabels selectors:moreSelectors after:nil |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
634 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
635 |
"Modified: 28.2.1996 / 17:46:50 / cg" |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
636 |
! |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
637 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
638 |
addLabels:moreLabels selectors:moreSelectors accelerators:shorties |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
639 |
"add more labels and selectors at the END" |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
640 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
641 |
self addLabels:moreLabels selectors:moreSelectors accelerators:shorties after:nil |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
642 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
643 |
"Modified: 28.2.1996 / 17:46:50 / cg" |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
644 |
"Created: 28.2.1996 / 17:47:17 / cg" |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
645 |
! |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
646 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
647 |
addLabels:moreLabels selectors:moreSelectors accelerators:shorties after:aLabelOrSelectorOrNumber |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
648 |
"insert more labels/selectors at some place. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
649 |
Being very friendly here, allowing label-string, selector or numeric |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
650 |
index for the argument aLabelOrSelectorOrNumber. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
651 |
If such an item is not found, insert the new items at the END. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
652 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
653 |
To be independent of the entries label, we recommend you use the selector |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
654 |
as index; in systems which translate strings for national variants, |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
655 |
this makes your code easier to maintain." |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
656 |
|
202 | 657 |
|idx| |
658 |
||
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
659 |
aLabelOrSelectorOrNumber isNil ifTrue:[ |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
660 |
idx := list size + 1 |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
661 |
] ifFalse:[ |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
662 |
idx := (self indexOf:aLabelOrSelectorOrNumber) + 1. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
663 |
idx == 1 ifTrue:[ |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
664 |
idx := list size + 1 |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
665 |
] |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
666 |
]. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
667 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
668 |
^ self |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
669 |
addLabels:moreLabels |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
670 |
selectors:moreSelectors |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
671 |
accelerators:shorties |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
672 |
before:idx |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
673 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
674 |
"Created: 28.2.1996 / 17:48:24 / cg" |
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
463
diff
changeset
|
675 |
"Modified: 4.3.1996 / 23:26:02 / cg" |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
676 |
! |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
677 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
678 |
addLabels:moreLabels selectors:moreSelectors accelerators:shorties before:aLabelOrSelectorOrNumber |
3294
a3266e46b191
handle nonString items correctly
Stefan Vogel <sv@exept.de>
parents:
3153
diff
changeset
|
679 |
self |
a3266e46b191
handle nonString items correctly
Stefan Vogel <sv@exept.de>
parents:
3153
diff
changeset
|
680 |
addLabels:moreLabels |
a3266e46b191
handle nonString items correctly
Stefan Vogel <sv@exept.de>
parents:
3153
diff
changeset
|
681 |
selectors:moreSelectors |
a3266e46b191
handle nonString items correctly
Stefan Vogel <sv@exept.de>
parents:
3153
diff
changeset
|
682 |
accelerators:shorties |
a3266e46b191
handle nonString items correctly
Stefan Vogel <sv@exept.de>
parents:
3153
diff
changeset
|
683 |
resources:nil |
a3266e46b191
handle nonString items correctly
Stefan Vogel <sv@exept.de>
parents:
3153
diff
changeset
|
684 |
before:aLabelOrSelectorOrNumber |
131 | 685 |
! |
686 |
||
2923
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
687 |
addLabels:moreLabels selectors:moreSelectors accelerators:shorties resources:resources after:aLabelOrSelectorOrNumber |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
688 |
"insert more labels/selectors at some place. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
689 |
Being very friendly here, allowing label-string, selector or numeric |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
690 |
index for the argument aLabelOrSelectorOrNumber. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
691 |
If such an item is not found, insert the new items at the END. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
692 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
693 |
To be independent of the entries label, we recommend you use the selector |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
694 |
as index; in systems which translate strings for national variants, |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
695 |
this makes your code easier to maintain." |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
696 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
697 |
|idx| |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
698 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
699 |
aLabelOrSelectorOrNumber isNil ifTrue:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
700 |
idx := list size + 1 |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
701 |
] ifFalse:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
702 |
idx := (self indexOf:aLabelOrSelectorOrNumber) + 1. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
703 |
idx == 1 ifTrue:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
704 |
idx := list size + 1 |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
705 |
] |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
706 |
]. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
707 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
708 |
^ self |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
709 |
addLabels:moreLabels |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
710 |
selectors:moreSelectors |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
711 |
accelerators:shorties |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
712 |
resources:resources |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
713 |
before:idx |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
714 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
715 |
"Created: 28.2.1996 / 17:48:24 / cg" |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
716 |
"Modified: 4.3.1996 / 23:26:02 / cg" |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
717 |
! |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
718 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
719 |
addLabels:moreLabels selectors:moreSelectors accelerators:shorties resources:resources before:aLabelOrSelectorOrNumber |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
720 |
"insert more labels/selectors at some place. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
721 |
Being very friendly here, allowing label-string, selector or numeric |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
722 |
index for the argument aLabelOrSelectorOrNumber. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
723 |
If such an item is not found, insert the new items at the beginning. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
724 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
725 |
To be independent of the entries label, we recommend you use the selector |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
726 |
as index; in systems which translate strings for national variants, |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
727 |
this makes your code easier to maintain." |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
728 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
729 |
|idx oldSize |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
730 |
i "{ Class: SmallInteger }" |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
731 |
nMore "{ Class: SmallInteger }"| |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
732 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
733 |
list isNil ifTrue:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
734 |
^ self addLabels:moreLabels selectors:moreSelectors resources:resources |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
735 |
]. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
736 |
" |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
737 |
be user friendly - allow both label or selector |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
738 |
to be passed |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
739 |
" |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
740 |
aLabelOrSelectorOrNumber isNil ifTrue:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
741 |
idx := 1 |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
742 |
] ifFalse:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
743 |
idx := self indexOf:aLabelOrSelectorOrNumber. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
744 |
(idx between:2 and:(list size + 1)) ifFalse:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
745 |
"add to beginning" |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
746 |
idx := 1 |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
747 |
] |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
748 |
]. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
749 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
750 |
nMore := moreLabels size. |
3294
a3266e46b191
handle nonString items correctly
Stefan Vogel <sv@exept.de>
parents:
3153
diff
changeset
|
751 |
self assert:moreSelectors size == nMore. |
2923
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
752 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
753 |
oldSize := list size. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
754 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
755 |
list := list asOrderedCollection. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
756 |
i := idx. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
757 |
moreLabels do:[:aLabel | |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
758 |
|l| |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
759 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
760 |
resources notNil |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
761 |
ifTrue:[l := resources string:aLabel] |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
762 |
ifFalse:[l := aLabel]. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
763 |
|
2973 | 764 |
l := self labelWithoutDoubleAmpersands:l. |
2923
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
765 |
list add:l beforeIndex:i. i := i + 1. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
766 |
]. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
767 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
768 |
selectors := (selectors ? #()) asOrderedCollection. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
769 |
i := idx. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
770 |
moreSelectors do:[:sel | |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
771 |
selectors add:sel beforeIndex:i. i := i + 1. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
772 |
]. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
773 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
774 |
enableFlags := (enableFlags ? #()) asOrderedCollection. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
775 |
i := idx. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
776 |
nMore timesRepeat:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
777 |
enableFlags add:true beforeIndex:i. i := i + 1. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
778 |
]. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
779 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
780 |
subMenus notNil ifTrue:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
781 |
subMenus := subMenus asOrderedCollection. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
782 |
i := idx. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
783 |
i >= subMenus size ifTrue:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
784 |
subMenus grow:i-1 |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
785 |
]. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
786 |
nMore timesRepeat:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
787 |
subMenus add:nil beforeIndex:i. i := i + 1. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
788 |
]. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
789 |
]. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
790 |
args notNil ifTrue:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
791 |
args := args asOrderedCollection. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
792 |
i := idx. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
793 |
i >= args size ifTrue:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
794 |
args grow:i-1 |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
795 |
]. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
796 |
nMore timesRepeat:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
797 |
args add:nil beforeIndex:i. i := i + 1. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
798 |
] |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
799 |
]. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
800 |
actions notNil ifTrue:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
801 |
actions := actions asOrderedCollection. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
802 |
i := idx. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
803 |
i >= actions size ifTrue:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
804 |
actions grow:i-1 |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
805 |
]. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
806 |
nMore timesRepeat:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
807 |
actions add:nil beforeIndex:i. i := i + 1. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
808 |
] |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
809 |
]. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
810 |
onOffFlags notNil ifTrue:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
811 |
onOffFlags := onOffFlags asOrderedCollection. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
812 |
i := idx. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
813 |
i >= onOffFlags size ifTrue:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
814 |
onOffFlags grow:i-1 |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
815 |
]. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
816 |
nMore timesRepeat:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
817 |
onOffFlags add:nil beforeIndex:i. i := i + 1. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
818 |
] |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
819 |
]. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
820 |
shortKeys isNil ifTrue:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
821 |
shortKeys := OrderedCollection new:oldSize. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
822 |
shortKeys grow:oldSize |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
823 |
]. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
824 |
shortKeys := shortKeys asOrderedCollection. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
825 |
i := idx. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
826 |
shorties isNil ifTrue:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
827 |
nMore timesRepeat:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
828 |
shortKeys add:nil beforeIndex:i. i := i + 1. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
829 |
] |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
830 |
] ifFalse:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
831 |
maxShortKeyStringLen := nil. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
832 |
shorties do:[:sel | |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
833 |
shortKeys add:sel beforeIndex:i. i := i + 1. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
834 |
] |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
835 |
]. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
836 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
837 |
shown ifTrue:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
838 |
self resize |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
839 |
] ifFalse:[ |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
840 |
needResize := true |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
841 |
]. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
842 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
843 |
" |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
844 |
|v1 v2 v3 v4 v5 m| |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
845 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
846 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
847 |
v1 := CodeView new open. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
848 |
v1 contents:'original menu'. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
849 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
850 |
v2 := CodeView new open. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
851 |
v2 contents:'before copy'. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
852 |
m := v2 editMenu. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
853 |
m |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
854 |
addLabels:#('new entry1' 'new entry2') |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
855 |
selectors:#(foo bar) |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
856 |
before:#copySelection |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
857 |
accelerators:#(Copy Cut Paste). |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
858 |
v2 middleButtonMenu:m. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
859 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
860 |
v3 := CodeView new open. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
861 |
v3 contents:'before again '. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
862 |
m := v3 editMenu. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
863 |
m |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
864 |
addLabels:#('new entry1' 'new entry2') |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
865 |
selectors:#(foo bar) |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
866 |
before:#again. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
867 |
v3 middleButtonMenu:m. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
868 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
869 |
v4 := CodeView new open. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
870 |
v4 contents:'at beginning '. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
871 |
m := v4 editMenu. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
872 |
m |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
873 |
addLabels:#('new entry1' 'new entry2' '-') |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
874 |
selectors:#(foo bar nil) |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
875 |
before:1. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
876 |
v4 middleButtonMenu:m. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
877 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
878 |
v5 := CodeView new open. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
879 |
v5 contents:'at end '. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
880 |
m := v5 editMenu. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
881 |
m |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
882 |
addLabels:#('-' 'new entry1' 'new entry2') |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
883 |
selectors:#(nil foo bar). |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
884 |
v5 middleButtonMenu:m. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
885 |
" |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
886 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
887 |
"Created: 28.2.1996 / 17:49:44 / cg" |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
888 |
"Modified: 24.3.1996 / 17:12:23 / cg" |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
889 |
! |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
890 |
|
119 | 891 |
addLabels:moreLabels selectors:moreSelectors after:aLabelOrSelectorOrNumber |
892 |
"insert more labels/selectors at some place. |
|
893 |
Being very friendly here, allowing label-string, selector or numeric |
|
894 |
index for the argument aLabelOrSelectorOrNumber. |
|
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
895 |
If such an item is not found, insert the new items at the END. |
119 | 896 |
|
897 |
To be independent of the entries label, we recommend you use the selector |
|
898 |
as index; in systems which translate strings for national variants, |
|
899 |
this makes your code easier to maintain." |
|
900 |
||
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
901 |
^ self |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
902 |
addLabels:moreLabels |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
903 |
selectors:moreSelectors |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
904 |
accelerators:nil |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
905 |
after:aLabelOrSelectorOrNumber |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
906 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
907 |
"Modified: 28.2.1996 / 17:47:52 / cg" |
119 | 908 |
! |
909 |
||
910 |
addLabels:moreLabels selectors:moreSelectors before:aLabelOrSelectorOrNumber |
|
911 |
"insert more labels/selectors at some place. |
|
912 |
Being very friendly here, allowing label-string, selector or numeric |
|
913 |
index for the argument aLabelOrSelectorOrNumber. |
|
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
914 |
If such an item is not found, insert the new items at the beginning. |
119 | 915 |
|
916 |
To be independent of the entries label, we recommend you use the selector |
|
917 |
as index; in systems which translate strings for national variants, |
|
918 |
this makes your code easier to maintain." |
|
919 |
||
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
920 |
self |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
921 |
addLabels:moreLabels |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
922 |
selectors:moreSelectors |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
923 |
accelerators:nil |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
924 |
before:aLabelOrSelectorOrNumber |
119 | 925 |
|
926 |
" |
|
927 |
|v1 v2 v3 v4 m| |
|
928 |
||
929 |
||
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
930 |
v1 := CodeView new open. |
119 | 931 |
|
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
932 |
v2 := CodeView new open. |
119 | 933 |
m := v2 editMenu. |
934 |
m |
|
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
935 |
addLabels:#('new entry1' 'new entry2') |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
936 |
selectors:#(foo bar) |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
937 |
before:'paste'. |
119 | 938 |
v2 middleButtonMenu:m. |
939 |
||
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
940 |
v3 := CodeView new open. |
119 | 941 |
m := v3 editMenu. |
942 |
m |
|
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
943 |
addLabels:#('new entry1' 'new entry2') |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
944 |
selectors:#(foo bar) |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
945 |
before:#again. |
119 | 946 |
v3 middleButtonMenu:m. |
947 |
||
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
948 |
v4 := CodeView new open. |
119 | 949 |
m := v4 editMenu. |
950 |
m |
|
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
951 |
addLabels:#('new entry1' 'new entry2') |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
952 |
selectors:#(foo bar) |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
953 |
before:1. |
119 | 954 |
v4 middleButtonMenu:m. |
95 | 955 |
" |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
956 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
957 |
"Modified: 28.2.1996 / 17:49:30 / cg" |
95 | 958 |
! |
959 |
||
2923
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
960 |
addLabels:moreLabels selectors:moreSelectors resources:resources |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
961 |
"add more labels and selectors at the END" |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
962 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
963 |
self addLabels:moreLabels selectors:moreSelectors resources:resources after:nil |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
964 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
965 |
"Modified: 28.2.1996 / 17:46:50 / cg" |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
966 |
! |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
967 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
968 |
addLabels:moreLabels selectors:moreSelectors resources:resources accelerators:shorties |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
969 |
"add more labels and selectors at the END" |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
970 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
971 |
self addLabels:moreLabels selectors:moreSelectors accelerators:shorties resources:resources after:nil |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
972 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
973 |
"Modified: 28.2.1996 / 17:46:50 / cg" |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
974 |
"Created: 28.2.1996 / 17:47:17 / cg" |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
975 |
! |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
976 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
977 |
addLabels:moreLabels selectors:moreSelectors resources:resources after:aLabelOrSelectorOrNumber |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
978 |
"insert more labels/selectors at some place. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
979 |
Being very friendly here, allowing label-string, selector or numeric |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
980 |
index for the argument aLabelOrSelectorOrNumber. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
981 |
If such an item is not found, insert the new items at the END. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
982 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
983 |
To be independent of the entries label, we recommend you use the selector |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
984 |
as index; in systems which translate strings for national variants, |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
985 |
this makes your code easier to maintain." |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
986 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
987 |
^ self |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
988 |
addLabels:moreLabels |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
989 |
selectors:moreSelectors |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
990 |
accelerators:nil |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
991 |
resources:resources |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
992 |
after:aLabelOrSelectorOrNumber |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
993 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
994 |
"Modified: 28.2.1996 / 17:47:52 / cg" |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
995 |
! |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
996 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
997 |
addLabels:moreLabels selectors:moreSelectors resources:resources before:aLabelOrSelectorOrNumber |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
998 |
"insert more labels/selectors at some place. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
999 |
Being very friendly here, allowing label-string, selector or numeric |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1000 |
index for the argument aLabelOrSelectorOrNumber. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1001 |
If such an item is not found, insert the new items at the beginning. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1002 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1003 |
To be independent of the entries label, we recommend you use the selector |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1004 |
as index; in systems which translate strings for national variants, |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1005 |
this makes your code easier to maintain." |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1006 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1007 |
self |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1008 |
addLabels:moreLabels |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1009 |
selectors:moreSelectors |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1010 |
accelerators:nil |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1011 |
resources:resources |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1012 |
before:aLabelOrSelectorOrNumber |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1013 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1014 |
" |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1015 |
|v1 v2 v3 v4 m| |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1016 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1017 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1018 |
v1 := CodeView new open. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1019 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1020 |
v2 := CodeView new open. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1021 |
m := v2 editMenu. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1022 |
m |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1023 |
addLabels:#('new entry1' 'new entry2') |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1024 |
selectors:#(foo bar) |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1025 |
before:'paste'. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1026 |
v2 middleButtonMenu:m. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1027 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1028 |
v3 := CodeView new open. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1029 |
m := v3 editMenu. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1030 |
m |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1031 |
addLabels:#('new entry1' 'new entry2') |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1032 |
selectors:#(foo bar) |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1033 |
before:#again. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1034 |
v3 middleButtonMenu:m. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1035 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1036 |
v4 := CodeView new open. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1037 |
m := v4 editMenu. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1038 |
m |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1039 |
addLabels:#('new entry1' 'new entry2') |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1040 |
selectors:#(foo bar) |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1041 |
before:1. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1042 |
v4 middleButtonMenu:m. |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1043 |
" |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1044 |
|
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1045 |
"Modified: 28.2.1996 / 17:49:30 / cg" |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1046 |
! |
1eaa937f0568
added protocol to add an itemList with resource-translation
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
1047 |
|
202 | 1048 |
addSeparatingLine |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1049 |
"add a separating line at the END" |
60 | 1050 |
|
202 | 1051 |
self addLabel:'-' selector:nil |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1052 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1053 |
"Modified: 28.2.1996 / 17:50:08 / cg" |
60 | 1054 |
! |
1055 |
||
202 | 1056 |
addSeparatingLineAfter:aLabelOrSelectorOrNumber |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1057 |
"add a separating line after an item" |
133 | 1058 |
|
202 | 1059 |
self addLabel:'-' selector:nil after:aLabelOrSelectorOrNumber |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1060 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1061 |
"Modified: 28.2.1996 / 17:50:14 / cg" |
0 | 1062 |
! |
1063 |
||
1064 |
args |
|
1065 |
"return the argument array" |
|
1066 |
||
1067 |
^ args |
|
1068 |
! |
|
1069 |
||
1070 |
args:anArray |
|
1071 |
"set the argument array" |
|
1072 |
||
604
04f04206a2fc
also copy selectors, args & shortKeys
Claus Gittinger <cg@exept.de>
parents:
603
diff
changeset
|
1073 |
args := anArray copy |
04f04206a2fc
also copy selectors, args & shortKeys
Claus Gittinger <cg@exept.de>
parents:
603
diff
changeset
|
1074 |
|
04f04206a2fc
also copy selectors, args & shortKeys
Claus Gittinger <cg@exept.de>
parents:
603
diff
changeset
|
1075 |
"Modified: 30.4.1996 / 15:55:03 / cg" |
0 | 1076 |
! |
1077 |
||
1078 |
argsAt:indexOrName put:something |
|
1079 |
"set an individual selector" |
|
1080 |
||
3 | 1081 |
|i| |
1082 |
||
1083 |
i := self indexOf:indexOrName. |
|
1084 |
i ~~ 0 ifTrue:[args at:i put:something] |
|
0 | 1085 |
! |
1086 |
||
202 | 1087 |
checkFlags |
1088 |
"return an array filled with the check-mark flags. |
|
1089 |
Non check-menu items have a nil entry in this array." |
|
0 | 1090 |
|
202 | 1091 |
^ onOffFlags |
0 | 1092 |
! |
1093 |
||
1094 |
checkToggleAt:indexOrName |
|
569
8c460366645e
checkToggleAt returns nil for non-check entries
Claus Gittinger <cg@exept.de>
parents:
543
diff
changeset
|
1095 |
"return a check-toggles boolean state. |
8c460366645e
checkToggleAt returns nil for non-check entries
Claus Gittinger <cg@exept.de>
parents:
543
diff
changeset
|
1096 |
If the item is not a check-item, return nil." |
0 | 1097 |
|
1098 |
|index| |
|
1099 |
||
1100 |
index := self indexOf:indexOrName. |
|
569
8c460366645e
checkToggleAt returns nil for non-check entries
Claus Gittinger <cg@exept.de>
parents:
543
diff
changeset
|
1101 |
index == 0 ifTrue:[^ nil]. |
8c460366645e
checkToggleAt returns nil for non-check entries
Claus Gittinger <cg@exept.de>
parents:
543
diff
changeset
|
1102 |
onOffFlags isNil ifTrue:[^ nil]. |
8c460366645e
checkToggleAt returns nil for non-check entries
Claus Gittinger <cg@exept.de>
parents:
543
diff
changeset
|
1103 |
index > onOffFlags size ifTrue:[^ nil]. |
0 | 1104 |
^ onOffFlags at:index |
569
8c460366645e
checkToggleAt returns nil for non-check entries
Claus Gittinger <cg@exept.de>
parents:
543
diff
changeset
|
1105 |
|
8c460366645e
checkToggleAt returns nil for non-check entries
Claus Gittinger <cg@exept.de>
parents:
543
diff
changeset
|
1106 |
"Modified: 22.4.1996 / 10:51:54 / cg" |
0 | 1107 |
! |
1108 |
||
1109 |
checkToggleAt:indexOrName put:aBoolean |
|
1110 |
"set/clear a check-toggle" |
|
1111 |
||
1112 |
|index| |
|
1113 |
||
1114 |
index := self indexOf:indexOrName. |
|
475
ce306c6c6bc4
care for toggles when adding labels
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
1115 |
index == 0 ifTrue:[ |
481 | 1116 |
"/ 'no item: ' print. indexOrName printNL. |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1117 |
^ self |
475
ce306c6c6bc4
care for toggles when adding labels
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
1118 |
]. |
65 | 1119 |
|
1120 |
onOffFlags isNil ifTrue:[ |
|
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1121 |
onOffFlags := Array new:(list size) |
65 | 1122 |
]. |
0 | 1123 |
onOffFlags at:index put:aBoolean. |
1124 |
shown ifTrue:[ |
|
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1125 |
self redrawLine:index |
0 | 1126 |
] |
475
ce306c6c6bc4
care for toggles when adding labels
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
1127 |
|
481 | 1128 |
"Modified: 6.3.1996 / 16:31:43 / cg" |
202 | 1129 |
! |
1130 |
||
1131 |
indexOf:indexOrName |
|
1132 |
"return the index of the label named:aName or , if its a symbol |
|
593 | 1133 |
the index in the selector list. |
1134 |
If indexOrName is not a valid item, return 0." |
|
202 | 1135 |
|
1136 |
indexOrName isSymbol ifTrue:[ |
|
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1137 |
^ selectors indexOf:indexOrName |
202 | 1138 |
]. |
1139 |
indexOrName isString ifTrue:[ |
|
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1140 |
^ list indexOf:indexOrName |
202 | 1141 |
]. |
1142 |
indexOrName isNil ifTrue:[^ 0]. |
|
593 | 1143 |
|
1144 |
(indexOrName respondsTo:#string) ifTrue:[ |
|
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1145 |
^ list indexOf:indexOrName asString |
593 | 1146 |
]. |
202 | 1147 |
^ indexOrName |
593 | 1148 |
|
1149 |
"Modified: 27.4.1996 / 15:25:16 / cg" |
|
202 | 1150 |
! |
1151 |
||
1152 |
labelAt:indexOrName put:aString |
|
1153 |
"change the label at index to be aString" |
|
1154 |
||
1155 |
|i nItems| |
|
1156 |
||
1157 |
i := self indexOf:indexOrName. |
|
1158 |
i == 0 ifTrue:[^ self]. |
|
1159 |
list at:i put:aString. |
|
1160 |
||
1161 |
"create onOff flags, if this label has a check-mark" |
|
1162 |
(self isCheckItem:aString) ifTrue:[ |
|
1163 |
nItems := list size. |
|
1164 |
onOffFlags isNil ifTrue:[ |
|
1165 |
onOffFlags := Array new:nItems |
|
1166 |
] ifFalse:[ |
|
1167 |
[onOffFlags size < nItems] whileTrue:[ |
|
1168 |
onOffFlags := onOffFlags copyWith:nil |
|
1169 |
] |
|
1170 |
]. |
|
1171 |
onOffFlags at:i put:false |
|
1172 |
]. |
|
1173 |
shown ifTrue:[ |
|
1174 |
self resize |
|
1175 |
] ifFalse:[ |
|
1176 |
needResize := true |
|
1177 |
] |
|
1178 |
! |
|
1179 |
||
1180 |
labels |
|
1181 |
"return the menu-labels" |
|
1182 |
||
1183 |
^ list |
|
1184 |
! |
|
1185 |
||
1186 |
labels:text |
|
1187 |
"set the labels to the argument, text" |
|
1188 |
||
908 | 1189 |
|l nItems| |
202 | 1190 |
|
1191 |
(text isString) ifTrue:[ |
|
2953 | 1192 |
l := text asStringCollection |
202 | 1193 |
] ifFalse:[ |
2953 | 1194 |
l := text copy |
202 | 1195 |
]. |
2973 | 1196 |
l := l collect:[:s | self labelWithoutDoubleAmpersands:s]. |
202 | 1197 |
"/ self list:l |
1198 |
self setList:l expandTabs:false. |
|
908 | 1199 |
nItems := list size. |
1200 |
enableFlags := Array new:nItems withAll:true. |
|
1201 |
onOffFlags := Array new:nItems. |
|
1048 | 1202 |
|
1203 |
text notNil ifTrue:[ |
|
2953 | 1204 |
text keysAndValuesDo:[:index :line | |
1205 |
(self isCheckItem:line) ifTrue:[ |
|
1206 |
onOffFlags at:index put:false |
|
1207 |
]. |
|
1208 |
]. |
|
202 | 1209 |
]. |
1210 |
shown ifTrue:[ |
|
2953 | 1211 |
self resize |
202 | 1212 |
] ifFalse:[ |
2953 | 1213 |
needResize := true |
202 | 1214 |
] |
603
9760b8c7f5de
create a copy of the labels (in case someone changes it later)
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1215 |
|
908 | 1216 |
"Modified: 2.1.1997 / 17:30:41 / cg" |
202 | 1217 |
! |
1218 |
||
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1219 |
labels:text selectors:selArray accelerators:shorties args:argArray receiver:anObject |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1220 |
"set all relevant stuff" |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1221 |
|
604
04f04206a2fc
also copy selectors, args & shortKeys
Claus Gittinger <cg@exept.de>
parents:
603
diff
changeset
|
1222 |
self labels:text selectors:selArray args:argArray receiver:anObject. |
04f04206a2fc
also copy selectors, args & shortKeys
Claus Gittinger <cg@exept.de>
parents:
603
diff
changeset
|
1223 |
shortKeys := shorties copy. |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1224 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1225 |
"Created: 28.2.1996 / 18:56:38 / cg" |
604
04f04206a2fc
also copy selectors, args & shortKeys
Claus Gittinger <cg@exept.de>
parents:
603
diff
changeset
|
1226 |
"Modified: 30.4.1996 / 15:54:48 / cg" |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1227 |
! |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1228 |
|
202 | 1229 |
labels:text selectors:selArray args:argArray receiver:anObject |
1230 |
"set all relevant stuff" |
|
1231 |
||
1232 |
self labels:text. |
|
642 | 1233 |
selArray isSymbol ifTrue:[ |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1234 |
selectors := Array new:(text size) withAll:selArray |
642 | 1235 |
] ifFalse:[ |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1236 |
selectors := selArray copy. |
642 | 1237 |
]. |
604
04f04206a2fc
also copy selectors, args & shortKeys
Claus Gittinger <cg@exept.de>
parents:
603
diff
changeset
|
1238 |
args := argArray copy. |
202 | 1239 |
receiver := anObject |
604
04f04206a2fc
also copy selectors, args & shortKeys
Claus Gittinger <cg@exept.de>
parents:
603
diff
changeset
|
1240 |
|
642 | 1241 |
"Modified: 14.5.1996 / 15:30:10 / cg" |
202 | 1242 |
! |
1243 |
||
963 | 1244 |
menuPerformer:someone |
1245 |
"set the menuPerformer of the message. |
|
1246 |
This also sets the menuPerformer in all subMenus." |
|
1247 |
||
1248 |
menuPerformer := someone. |
|
1249 |
subMenus notNil ifTrue:[ |
|
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1250 |
subMenus do:[:aMenu | |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1251 |
aMenu notNil ifTrue:[ |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1252 |
aMenu menuPerformer:someone |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1253 |
] |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1254 |
] |
963 | 1255 |
] |
1256 |
||
1257 |
"Created: 21.1.1997 / 15:42:00 / cg" |
|
1258 |
! |
|
1259 |
||
202 | 1260 |
receiver |
1261 |
"return the receiver of the message" |
|
1262 |
||
1263 |
^ receiver |
|
1264 |
! |
|
1265 |
||
1266 |
receiver:anObject |
|
963 | 1267 |
"set the receiver of the message. |
1268 |
This also sets the receiver in all subMenus." |
|
202 | 1269 |
|
1270 |
receiver := anObject. |
|
1271 |
subMenus notNil ifTrue:[ |
|
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1272 |
subMenus do:[:aMenu | |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1273 |
aMenu notNil ifTrue:[ |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1274 |
aMenu receiver:anObject |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1275 |
] |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1276 |
] |
202 | 1277 |
] |
963 | 1278 |
|
1279 |
"Modified: 21.1.1997 / 15:41:32 / cg" |
|
202 | 1280 |
! |
1281 |
||
1282 |
remove:indexOrName |
|
1283 |
"remove the label at index" |
|
1284 |
||
1285 |
|i| |
|
1286 |
||
1287 |
i := self indexOf:indexOrName. |
|
1288 |
i == 0 ifTrue:[^ self]. |
|
1289 |
list := list asOrderedCollection removeIndex:i. |
|
1290 |
selectors := selectors asOrderedCollection removeIndex:i. |
|
1291 |
enableFlags := enableFlags asOrderedCollection removeIndex:i. |
|
1292 |
subMenus notNil ifTrue:[ |
|
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1293 |
subMenus := subMenus asOrderedCollection removeIndex:i. |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1294 |
]. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1295 |
shortKeys notNil ifTrue:[ |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1296 |
shortKeys := shortKeys asOrderedCollection removeIndex:i. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1297 |
maxShortKeyStringLen := nil. |
202 | 1298 |
]. |
1299 |
shown ifTrue:[ |
|
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1300 |
self resize |
202 | 1301 |
] ifFalse:[ |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1302 |
needResize := true |
202 | 1303 |
] |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1304 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1305 |
"Modified: 28.2.1996 / 18:27:57 / cg" |
202 | 1306 |
! |
1307 |
||
1308 |
selectorAt:indexOrName |
|
1309 |
"return an individual selector" |
|
1310 |
||
1311 |
|i| |
|
1312 |
||
1313 |
i := self indexOf:indexOrName. |
|
1314 |
i ~~ 0 ifTrue:[^ selectors at:i]. |
|
1315 |
^ nil |
|
1316 |
! |
|
1317 |
||
1318 |
selectorAt:indexOrName put:aSelector |
|
1319 |
"set an individual selector" |
|
1320 |
||
1321 |
|i| |
|
1322 |
||
1323 |
i := self indexOf:indexOrName. |
|
1324 |
i ~~ 0 ifTrue:[selectors at:i put:aSelector] |
|
1325 |
! |
|
1326 |
||
1327 |
selectors |
|
1328 |
"return the selector array" |
|
1329 |
||
1330 |
^ selectors |
|
1331 |
! |
|
1332 |
||
1333 |
selectors:anArray |
|
1334 |
"set the selector array" |
|
1335 |
||
604
04f04206a2fc
also copy selectors, args & shortKeys
Claus Gittinger <cg@exept.de>
parents:
603
diff
changeset
|
1336 |
selectors := anArray copy |
04f04206a2fc
also copy selectors, args & shortKeys
Claus Gittinger <cg@exept.de>
parents:
603
diff
changeset
|
1337 |
|
04f04206a2fc
also copy selectors, args & shortKeys
Claus Gittinger <cg@exept.de>
parents:
603
diff
changeset
|
1338 |
"Modified: 30.4.1996 / 15:54:07 / cg" |
202 | 1339 |
! |
1340 |
||
1341 |
someMenuItemLabeled:aLabel |
|
1342 |
"find a menu item. |
|
1343 |
Currently, in ST/X, instances of MenuItem are only created as dummy" |
|
1344 |
||
1345 |
|idx| |
|
1346 |
||
1347 |
idx := self indexOf:aLabel. |
|
1348 |
idx ~~ 0 ifTrue:[ |
|
1349 |
^ MenuItem new menu:self index:idx |
|
1350 |
]. |
|
1351 |
subMenus notNil ifTrue:[ |
|
1352 |
subMenus do:[:aMenu | |
|
1353 |
|item| |
|
1354 |
||
1355 |
aMenu notNil ifTrue:[ |
|
1356 |
(item := aMenu someMenuItemLabeled:aLabel) notNil ifTrue:[ |
|
1357 |
^ item |
|
1358 |
] |
|
1359 |
] |
|
1360 |
]. |
|
1361 |
]. |
|
1362 |
^ nil |
|
1363 |
! ! |
|
1364 |
||
1365 |
!MenuView methodsFor:'accessing-look'! |
|
1366 |
||
1367 |
font:aFont |
|
665 | 1368 |
"adjust size for new font. |
1369 |
CAVEAT: with the addition of Text objects, |
|
1989 | 1370 |
this method is going to be obsoleted by a textStyle |
1371 |
method, which allows specific control over |
|
1372 |
normalFont/boldFont/italicFont parameters." |
|
1373 |
||
1374 |
super font:(aFont onDevice:device). |
|
1232 | 1375 |
preferredExtent := nil. |
202 | 1376 |
shown ifTrue:[ |
1989 | 1377 |
self resize |
202 | 1378 |
] ifFalse:[ |
1989 | 1379 |
needResize := true |
202 | 1380 |
] |
665 | 1381 |
|
1382 |
"Modified: 22.5.1996 / 12:36:37 / cg" |
|
202 | 1383 |
! ! |
1384 |
||
1385 |
!MenuView methodsFor:'accessing-misc'! |
|
1386 |
||
1387 |
masterView |
|
1388 |
"return the popup-masterview I am contained in." |
|
1389 |
||
1390 |
^ masterView |
|
1391 |
! |
|
1392 |
||
1393 |
masterView:aPopUpView |
|
1394 |
"set the popup-masterview I am contained in." |
|
1395 |
||
1396 |
masterView := aPopUpView |
|
1397 |
! |
|
1398 |
||
1399 |
selection:index |
|
1400 |
|sel line| |
|
1401 |
||
1402 |
sel := index. |
|
1403 |
sel notNil ifTrue:[ |
|
1404 |
line := self listAt:index. |
|
1405 |
(self isGraphicItem:line) ifTrue:[ |
|
1406 |
" |
|
1407 |
not really selectable, but a separating line |
|
1408 |
" |
|
1409 |
sel := nil |
|
1410 |
] |
|
1411 |
]. |
|
1412 |
super selection:sel |
|
1413 |
! |
|
1414 |
||
683 | 1415 |
setSelection:index |
1416 |
|sel line| |
|
1417 |
||
1418 |
sel := index. |
|
1419 |
sel notNil ifTrue:[ |
|
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1420 |
line := self listAt:index. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1421 |
(self isGraphicItem:line) ifTrue:[ |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1422 |
" |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1423 |
not really selectable, but a separating line |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1424 |
" |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1425 |
sel := nil |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1426 |
] |
683 | 1427 |
]. |
1428 |
super setSelection:sel |
|
1429 |
||
1430 |
"Created: 25.5.1996 / 12:27:33 / cg" |
|
1431 |
! |
|
1432 |
||
334 | 1433 |
sizeFixed:aBoolean |
1434 |
sizeFixed := aBoolean |
|
1435 |
||
1436 |
"Created: 9.2.1996 / 01:12:40 / cg" |
|
1437 |
! |
|
1438 |
||
202 | 1439 |
superMenu |
1440 |
"ret the menu I am contained in |
|
1441 |
- need this to hide main menus when a submenu performed its action" |
|
1442 |
||
1443 |
^ superMenu |
|
1444 |
! |
|
1445 |
||
1446 |
superMenu:aMenu |
|
1447 |
"set the menu I am contained in |
|
1448 |
- need this to hide main menus when a submenu performed its action" |
|
1449 |
||
1450 |
superMenu := aMenu |
|
136 | 1451 |
! ! |
1452 |
||
1453 |
!MenuView methodsFor:'accessing-submenus'! |
|
1454 |
||
0 | 1455 |
subMenuAt:indexOrName |
1456 |
"return a submenu, or nil" |
|
1457 |
||
3 | 1458 |
|i| |
1459 |
||
0 | 1460 |
subMenus isNil ifTrue:[^ nil]. |
3 | 1461 |
i := self indexOf:indexOrName. |
1462 |
i == 0 ifTrue:[^ nil]. |
|
1463 |
^ subMenus at:i |
|
0 | 1464 |
! |
1465 |
||
1466 |
subMenuAt:indexOrName put:aPopUpMenu |
|
1467 |
"define a submenu" |
|
1468 |
||
59 | 1469 |
|i newSubMenus| |
3 | 1470 |
|
1471 |
i := self indexOf:indexOrName. |
|
2920 | 1472 |
i == 0 ifTrue:[ |
1473 |
'MenuView [warning]: no submenu with for index: ' infoPrint. indexOrName infoPrintCR. |
|
1474 |
^ nil |
|
1475 |
]. |
|
497 | 1476 |
|
59 | 1477 |
subMenus size < i ifTrue:[ |
2399
550e5ab64b82
care for nil arg in #subMenuAt:put:
Claus Gittinger <cg@exept.de>
parents:
2311
diff
changeset
|
1478 |
newSubMenus := Array new:(list size max:i). |
550e5ab64b82
care for nil arg in #subMenuAt:put:
Claus Gittinger <cg@exept.de>
parents:
2311
diff
changeset
|
1479 |
subMenus notNil ifTrue:[ |
550e5ab64b82
care for nil arg in #subMenuAt:put:
Claus Gittinger <cg@exept.de>
parents:
2311
diff
changeset
|
1480 |
newSubMenus replaceFrom:1 with:subMenus. |
550e5ab64b82
care for nil arg in #subMenuAt:put:
Claus Gittinger <cg@exept.de>
parents:
2311
diff
changeset
|
1481 |
]. |
550e5ab64b82
care for nil arg in #subMenuAt:put:
Claus Gittinger <cg@exept.de>
parents:
2311
diff
changeset
|
1482 |
subMenus := newSubMenus. |
550e5ab64b82
care for nil arg in #subMenuAt:put:
Claus Gittinger <cg@exept.de>
parents:
2311
diff
changeset
|
1483 |
shown ifTrue:[ |
550e5ab64b82
care for nil arg in #subMenuAt:put:
Claus Gittinger <cg@exept.de>
parents:
2311
diff
changeset
|
1484 |
self resize |
550e5ab64b82
care for nil arg in #subMenuAt:put:
Claus Gittinger <cg@exept.de>
parents:
2311
diff
changeset
|
1485 |
] ifFalse:[ |
550e5ab64b82
care for nil arg in #subMenuAt:put:
Claus Gittinger <cg@exept.de>
parents:
2311
diff
changeset
|
1486 |
needResize := true |
550e5ab64b82
care for nil arg in #subMenuAt:put:
Claus Gittinger <cg@exept.de>
parents:
2311
diff
changeset
|
1487 |
] |
0 | 1488 |
]. |
2683 | 1489 |
|
497 | 1490 |
subMenus at:i put:aPopUpMenu. |
2399
550e5ab64b82
care for nil arg in #subMenuAt:put:
Claus Gittinger <cg@exept.de>
parents:
2311
diff
changeset
|
1491 |
aPopUpMenu notNil ifTrue:[ |
550e5ab64b82
care for nil arg in #subMenuAt:put:
Claus Gittinger <cg@exept.de>
parents:
2311
diff
changeset
|
1492 |
aPopUpMenu device:device. |
550e5ab64b82
care for nil arg in #subMenuAt:put:
Claus Gittinger <cg@exept.de>
parents:
2311
diff
changeset
|
1493 |
(receiver notNil and:[aPopUpMenu receiver isNil]) ifTrue:[ |
550e5ab64b82
care for nil arg in #subMenuAt:put:
Claus Gittinger <cg@exept.de>
parents:
2311
diff
changeset
|
1494 |
aPopUpMenu receiver:receiver |
550e5ab64b82
care for nil arg in #subMenuAt:put:
Claus Gittinger <cg@exept.de>
parents:
2311
diff
changeset
|
1495 |
]. |
497 | 1496 |
]. |
1497 |
||
956 | 1498 |
"Modified: 17.1.1997 / 01:03:55 / cg" |
202 | 1499 |
! |
1500 |
||
1501 |
subMenuShown |
|
1502 |
"return the currently visible submenu - or nil if there is none" |
|
1503 |
||
1504 |
^ subMenuShown |
|
1505 |
! ! |
|
1506 |
||
1507 |
!MenuView methodsFor:'disabled scrolling'! |
|
1508 |
||
1509 |
makeSelectionVisible |
|
1510 |
^ self |
|
1511 |
! ! |
|
1512 |
||
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1513 |
!MenuView methodsFor:'drawing'! |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1514 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1515 |
drawAccelerator:aSymbolicKey inVisibleLine:visLineNr with:fg and:bg |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1516 |
"draw the accelerator at the right." |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1517 |
|
462
d66445011d3e
if there are both a short-key AND a submenu, indent differently
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
1518 |
|s x l isSubMenuEntry| |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1519 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1520 |
"/ this is somewhat complicated: we have the symbolic key at hand, |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1521 |
"/ but want to show the untranslated (inverse keyBoardMapped) key & modifier |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1522 |
"/ |
3323
ce80842d41e0
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
3294
diff
changeset
|
1523 |
s := device shortKeyStringFor:aSymbolicKey. |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1524 |
s isNil ifTrue:[^ self]. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1525 |
|
462
d66445011d3e
if there are both a short-key AND a submenu, indent differently
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
1526 |
l := self visibleLineToAbsoluteLine:visLineNr. |
2572
9b09dd9d9dae
dont forget to draw accelerator when disabled
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
1527 |
|
9b09dd9d9dae
dont forget to draw accelerator when disabled
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
1528 |
disabledEtchedFgColor notNil ifTrue:[ |
9b09dd9d9dae
dont forget to draw accelerator when disabled
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
1529 |
(self isInSelection:l) ifFalse:[ |
2575
a0381bf78464
oops - redraw bug with etched color fixed
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1530 |
(self isEnabled:l) ifFalse:[ |
a0381bf78464
oops - redraw bug with etched color fixed
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1531 |
s := s asText emphasisAllAdd:(#etchColor -> disabledEtchedFgColor) |
a0381bf78464
oops - redraw bug with etched color fixed
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1532 |
] |
2572
9b09dd9d9dae
dont forget to draw accelerator when disabled
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
1533 |
] |
9b09dd9d9dae
dont forget to draw accelerator when disabled
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
1534 |
]. |
462
d66445011d3e
if there are both a short-key AND a submenu, indent differently
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
1535 |
isSubMenuEntry := (subMenus notNil and:[(subMenus at:l) notNil]). |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1536 |
|
462
d66445011d3e
if there are both a short-key AND a submenu, indent differently
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
1537 |
isSubMenuEntry ifFalse:[ |
2572
9b09dd9d9dae
dont forget to draw accelerator when disabled
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
1538 |
"/ this aligns them along their left |
9b09dd9d9dae
dont forget to draw accelerator when disabled
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
1539 |
x := width - textStartLeft - self shortKeyInset. |
462
d66445011d3e
if there are both a short-key AND a submenu, indent differently
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
1540 |
] ifTrue:[ |
2572
9b09dd9d9dae
dont forget to draw accelerator when disabled
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
1541 |
"/ this aligns them at the right |
9b09dd9d9dae
dont forget to draw accelerator when disabled
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
1542 |
x := width - leftMargin - (font widthOf:s). |
9b09dd9d9dae
dont forget to draw accelerator when disabled
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
1543 |
x := x - 16 "/ should query for the arrow size here ... |
461
45282807f7fa
handle shortKey & submenu-arrow in one line; allow turning of of accelerator display
Claus Gittinger <cg@exept.de>
parents:
460
diff
changeset
|
1544 |
]. |
45282807f7fa
handle shortKey & submenu-arrow in one line; allow turning of of accelerator display
Claus Gittinger <cg@exept.de>
parents:
460
diff
changeset
|
1545 |
|
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1546 |
hilightStyle == #openwin ifTrue:[ |
2572
9b09dd9d9dae
dont forget to draw accelerator when disabled
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
1547 |
x := x - 2 "/ inset of rounded rectangle |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1548 |
]. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1549 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1550 |
self drawLine:s fromX:x inVisible:visLineNr with:fg and:bg |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1551 |
|
3323
ce80842d41e0
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
3294
diff
changeset
|
1552 |
"Created: / 28-02-1996 / 18:48:05 / cg" |
ce80842d41e0
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
3294
diff
changeset
|
1553 |
"Modified: / 08-08-2006 / 15:47:11 / cg" |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1554 |
! |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1555 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1556 |
drawCheckLine:line inVisibleLine:visLineNr with:fg and:bg |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1557 |
"draw an on/off-mark (or the space for it). |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1558 |
Supported checkmark types: |
1532 | 1559 |
\c simple mark; space if off |
1560 |
\b box mark |
|
1561 |
\t thumbsUp/thumbsDown mark |
|
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1562 |
" |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1563 |
|
1649
e0deb9ce1e08
fixed checkItem (\c) detection
Claus Gittinger <cg@exept.de>
parents:
1640
diff
changeset
|
1564 |
|w h y x l check xR yB form markIndex i2 markType found| |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1565 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1566 |
l := self visibleLineToListLine:visLineNr. |
1532 | 1567 |
onOffFlags isNil ifTrue:[^ false]. "/ not a check-item line |
1568 |
check := onOffFlags at:l ifAbsent:nil. |
|
1569 |
check isNil ifTrue:[^ false]. "/ not a check-item line |
|
1570 |
check := check value. |
|
1571 |
||
1572 |
markIndex := 1. |
|
1649
e0deb9ce1e08
fixed checkItem (\c) detection
Claus Gittinger <cg@exept.de>
parents:
1640
diff
changeset
|
1573 |
found := false. |
e0deb9ce1e08
fixed checkItem (\c) detection
Claus Gittinger <cg@exept.de>
parents:
1640
diff
changeset
|
1574 |
[markIndex ~~ 0 and:[found not]] whileTrue:[ |
1532 | 1575 |
markIndex := line indexOf:$\ startingAt:markIndex. |
1649
e0deb9ce1e08
fixed checkItem (\c) detection
Claus Gittinger <cg@exept.de>
parents:
1640
diff
changeset
|
1576 |
markIndex ~~ 0 ifTrue:[ |
e0deb9ce1e08
fixed checkItem (\c) detection
Claus Gittinger <cg@exept.de>
parents:
1640
diff
changeset
|
1577 |
i2 := markIndex + 1. |
e0deb9ce1e08
fixed checkItem (\c) detection
Claus Gittinger <cg@exept.de>
parents:
1640
diff
changeset
|
1578 |
found := 'cbt' includes:(line at:i2). |
e0deb9ce1e08
fixed checkItem (\c) detection
Claus Gittinger <cg@exept.de>
parents:
1640
diff
changeset
|
1579 |
found ifFalse:[ |
e0deb9ce1e08
fixed checkItem (\c) detection
Claus Gittinger <cg@exept.de>
parents:
1640
diff
changeset
|
1580 |
markIndex := i2 + 1. |
e0deb9ce1e08
fixed checkItem (\c) detection
Claus Gittinger <cg@exept.de>
parents:
1640
diff
changeset
|
1581 |
]. |
e0deb9ce1e08
fixed checkItem (\c) detection
Claus Gittinger <cg@exept.de>
parents:
1640
diff
changeset
|
1582 |
]. |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1583 |
]. |
1649
e0deb9ce1e08
fixed checkItem (\c) detection
Claus Gittinger <cg@exept.de>
parents:
1640
diff
changeset
|
1584 |
markIndex == 0ifTrue:[ |
e0deb9ce1e08
fixed checkItem (\c) detection
Claus Gittinger <cg@exept.de>
parents:
1640
diff
changeset
|
1585 |
^ super drawVisibleLine:visLineNr from:1 to:line size with:fg and:bg. |
e0deb9ce1e08
fixed checkItem (\c) detection
Claus Gittinger <cg@exept.de>
parents:
1640
diff
changeset
|
1586 |
]. |
e0deb9ce1e08
fixed checkItem (\c) detection
Claus Gittinger <cg@exept.de>
parents:
1640
diff
changeset
|
1587 |
|
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1588 |
markType := line at:i2. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1589 |
|
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2399
diff
changeset
|
1590 |
x := (self xOfCol:markIndex inVisibleLine:visLineNr) - viewOrigin x. |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1591 |
y := (self yOfVisibleLine:visLineNr) - (lineSpacing//2). |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1592 |
|
1219
ae43e68449c2
Fix printing of checkmark lines.
Stefan Vogel <sv@exept.de>
parents:
1059
diff
changeset
|
1593 |
self paint:bg. |
ae43e68449c2
Fix printing of checkmark lines.
Stefan Vogel <sv@exept.de>
parents:
1059
diff
changeset
|
1594 |
self fillRectangleX:margin y:y width:(width-(margin*2)) height:fontHeight. |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1595 |
markIndex ~~ 1 ifTrue:[ |
1532 | 1596 |
super drawVisibleLine:visLineNr from:1 to:(markIndex-1) with:fg and:bg. |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1597 |
]. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1598 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1599 |
(markType == $c) ifTrue:[ |
1532 | 1600 |
w := font widthOf:'V'. |
1601 |
check ifTrue:[ |
|
1602 |
form := checkOnImage. |
|
1603 |
] ifFalse:[ |
|
1604 |
form := checkOffImage. |
|
1605 |
] |
|
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1606 |
] ifFalse:[ |
1532 | 1607 |
(markType == $b) ifTrue:[ |
1608 |
w := font maxWidth. "/ font widthOf:' '. |
|
1609 |
] ifFalse:[ |
|
1610 |
(markType == $t) ifTrue:[ |
|
1611 |
check ifTrue:[form := Cursor thumbsUp sourceForm] |
|
1612 |
ifFalse:[form := Cursor thumbsDown sourceForm] |
|
1613 |
] |
|
1614 |
] |
|
1615 |
]. |
|
1616 |
||
1617 |
form notNil ifTrue:[ |
|
1618 |
w := form width. |
|
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1619 |
]. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1620 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1621 |
self drawLine:(line copyFrom:markIndex+2) fromX:x+w inVisible:visLineNr with:fg and:bg. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1622 |
self paint:(check ifTrue:[checkColor == bg ifTrue:[fg] ifFalse:[checkColor]] ifFalse:[fg]). |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1623 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1624 |
h := font ascent. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1625 |
y := y + (font height - h // 2). |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1626 |
yB := y + h - 1. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1627 |
|
1532 | 1628 |
form notNil ifTrue:[ |
1629 |
self displayForm:form x:x y:y |
|
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1630 |
] ifFalse:[ |
1532 | 1631 |
(markType == $c) ifTrue:[ |
1632 |
check ifTrue:[ |
|
1633 |
xR := x + (w // 3). |
|
1634 |
self displayLineFromX:x y:(y + (h // 2)) toX:xR y:yB. |
|
1635 |
self displayLineFromX:xR y:yB toX:(x + w - 1) y:y |
|
1636 |
] |
|
1637 |
] ifFalse:[ |
|
1638 |
(markType == $b) ifTrue:[ |
|
1639 |
check ifTrue:[ |
|
1640 |
xR := x + w - 2. |
|
1641 |
self displayLineFromX:x y:y toX:xR y:yB. |
|
1642 |
self displayLineFromX:xR y:y toX:x y:yB. |
|
1643 |
]. |
|
1644 |
self paint:fg. |
|
1645 |
self displayRectangleX:x y:y width:h height:h. |
|
1646 |
] |
|
1647 |
]. |
|
1648 |
]. |
|
1649 |
^ true |
|
1650 |
||
1651 |
"Modified: / 6.5.1997 / 18:04:38 / stefan" |
|
1649
e0deb9ce1e08
fixed checkItem (\c) detection
Claus Gittinger <cg@exept.de>
parents:
1640
diff
changeset
|
1652 |
"Modified: / 17.8.1998 / 10:25:01 / cg" |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1653 |
! |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1654 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1655 |
drawVisibleLine:visLineNr with:fg and:bg |
2113 | 1656 |
|lNr lineString xLatedLine isSpecial key| |
1657 |
||
1658 |
lNr := self visibleLineToListLine:visLineNr. |
|
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1659 |
lineString := self visibleAt:visLineNr. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1660 |
|
2960 | 1661 |
isSpecial := lineString notNil and:[lineString asString string includes:$\]. |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1662 |
isSpecial ifFalse:[ |
1532 | 1663 |
" |
1664 |
a normal entry |
|
1665 |
" |
|
1666 |
super drawVisibleLine:visLineNr with:fg and:bg |
|
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1667 |
] ifTrue:[ |
1532 | 1668 |
" |
1669 |
some speciality in this line; try checkMark |
|
1670 |
" |
|
1671 |
((self isCheckItem:lineString) |
|
1672 |
and:[self drawCheckLine:lineString inVisibleLine:visLineNr with:fg and:bg]) |
|
1673 |
ifFalse:[ |
|
2113 | 1674 |
xLatedLine := lineString replString:'\\' withString:'\'. |
1675 |
super drawLine:xLatedLine inVisible:visLineNr with:fg and:bg. |
|
1532 | 1676 |
]. |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1677 |
]. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1678 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1679 |
"/ |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1680 |
"/ is there a shortKey ? |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1681 |
"/ |
461
45282807f7fa
handle shortKey & submenu-arrow in one line; allow turning of of accelerator display
Claus Gittinger <cg@exept.de>
parents:
460
diff
changeset
|
1682 |
((ShowAcceleratorKeys ~~ false) |
433
5e7847297ef8
allow turning off display of shortKeys (via style-sheet)
Claus Gittinger <cg@exept.de>
parents:
426
diff
changeset
|
1683 |
and:[shortKeys notNil |
2113 | 1684 |
and:[(key := shortKeys at:lNr ifAbsent:nil) notNil]]) ifTrue:[ |
1532 | 1685 |
self drawAccelerator:key inVisibleLine:visLineNr with:fg and:bg |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1686 |
] |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1687 |
|
1919
7752e8980de5
allow for \\ to allow the single \ to be displayed (DOS filenames)
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
1688 |
"Modified: / 31.5.1999 / 12:35:48 / cg" |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1689 |
! |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1690 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1691 |
drawVisibleLineSelected:visLineNr with:fg and:bg |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1692 |
"redraw a single line as selected." |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1693 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1694 |
|listLine |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1695 |
y "{ Class: SmallInteger }" |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1696 |
y2 "{ Class: SmallInteger }" |
727 | 1697 |
r2 rI lI radius topLeftColor botRightColor | |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1698 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1699 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1700 |
hilightStyle ~~ #openwin ifTrue:[ |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1701 |
^ super drawVisibleLineSelected:visLineNr with:fg and:bg. |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1702 |
]. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1703 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1704 |
" |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1705 |
openwin draws selections in a menu as (edged) rounded rectangles |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1706 |
" |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1707 |
listLine := self visibleLineToListLine:visLineNr. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1708 |
listLine notNil ifTrue:[ |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1709 |
|
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1710 |
self drawVisibleLine:visLineNr with:fg and:bg. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1711 |
|
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1712 |
y := (self yOfVisibleLine:visLineNr) - (lineSpacing//2). |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1713 |
y2 := y + fontHeight - 1. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1714 |
r2 := fontHeight. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1715 |
radius := r2 // 2. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1716 |
rI := 0. "/ 2. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1717 |
lI := 1. "/ 2. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1718 |
|
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1719 |
" |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1720 |
refill with normal bg, where arcs will be drawn below |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1721 |
" |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1722 |
self paint:bgColor. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1723 |
self fillRectangleX:margin y:y width:radius height:fontHeight. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1724 |
self fillRectangleX:width-radius-margin y:y width:radius height:fontHeight. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1725 |
" |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1726 |
fill the arcs |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1727 |
" |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1728 |
self paint:hilightBgColor. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1729 |
self fillArcX:margin+lI y:y width:r2 height:r2+rI from:90 angle:180. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1730 |
self fillArcX:width-r2-rI-margin-1 y:y width:r2 height:r2+rI from:270 angle:180. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1731 |
|
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1732 |
" |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1733 |
a highlight-border around |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1734 |
" |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1735 |
hilightFrameColor notNil ifTrue:[ |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1736 |
self paint:hilightFrameColor. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1737 |
self displayLineFromX:radius+2 y:y toX:width-radius-3 y:y. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1738 |
self displayLineFromX:radius+2 y:y2 toX:width-radius-3 y:y2. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1739 |
|
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1740 |
self displayArcX:margin+lI y:y width:r2 height:r2+rI from:90 angle:180. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1741 |
self displayArcX:width-r2-rI-margin-1 y:y width:r2 height:r2+rI from:270 angle:180. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1742 |
^ self |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1743 |
]. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1744 |
|
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1745 |
" |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1746 |
an edge around |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1747 |
" |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1748 |
(hilightLevel ~~ 0) ifTrue:[ |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1749 |
(hilightLevel < 0) ifTrue:[ |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1750 |
topLeftColor := shadowColor. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1751 |
botRightColor := lightColor. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1752 |
] ifFalse:[ |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1753 |
topLeftColor := lightColor. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1754 |
botRightColor := shadowColor. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1755 |
]. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1756 |
|
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1757 |
self paint:topLeftColor. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1758 |
self displayLineFromX:radius+2 y:y toX:width-radius-3 y:y. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1759 |
|
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1760 |
self displayArcX:margin+lI y:y width:r2 height:r2+rI-1 from:90 angle:125. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1761 |
self displayArcX:width-r2-rI-margin-1 y:y width:r2 height:r2+rI-1 from:270+125 angle:55. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1762 |
|
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1763 |
self paint:botRightColor. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1764 |
|
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1765 |
self displayLineFromX:radius+2 y:y2 toX:width-radius-3 y:y2. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1766 |
self displayArcX:margin+lI y:y width:r2 height:r2+rI-1 from:90+125 angle:55. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1767 |
self displayArcX:width-r2-rI-margin-1 y:y width:r2 height:r2+rI-1 from:270 angle:125. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1768 |
]. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1769 |
^ self |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1770 |
]. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1771 |
^ super drawVisibleLine:visLineNr with:fg and:bg |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1772 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1773 |
"Created: 28.2.1996 / 18:41:17 / cg" |
1346
98f855d33d66
fixed arc-edges for openWin style
Claus Gittinger <cg@exept.de>
parents:
1285
diff
changeset
|
1774 |
"Modified: 14.10.1997 / 00:05:43 / cg" |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1775 |
! ! |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1776 |
|
202 | 1777 |
!MenuView methodsFor:'event handling'! |
1778 |
||
1779 |
buttonMotion:state x:x y:y |
|
3911
2e2c5429a2f9
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3903
diff
changeset
|
1780 |
(self sensor hasButtonMotionEventFor:self) ifFalse:[ |
2e2c5429a2f9
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3903
diff
changeset
|
1781 |
self setSelectionForX:x y:y |
202 | 1782 |
] |
1783 |
! |
|
1784 |
||
1785 |
buttonPress:button x:x y:y |
|
1058
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
1786 |
self setSelectionForX:x y:y. |
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
1787 |
|
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
1788 |
"Modified: 25.2.1997 / 22:32:22 / cg" |
202 | 1789 |
! |
1790 |
||
1791 |
buttonRelease:button x:x y:y |
|
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
463
diff
changeset
|
1792 |
|hide| |
202 | 1793 |
|
1794 |
subMenuShown notNil ifTrue:[ |
|
1864 | 1795 |
^ self |
202 | 1796 |
]. |
1797 |
||
1864 | 1798 |
(x >= 0 |
1799 |
and:[x < width |
|
1800 |
and:[y >= 0 |
|
1801 |
and:[y < height]]]) ifTrue:[ |
|
1802 |
superMenu notNil ifTrue:[ |
|
1803 |
superMenu submenuTriggered. |
|
1804 |
||
2818 | 1805 |
shown ifFalse:[ |
1864 | 1806 |
superView notNil ifTrue:[ |
1807 |
superView shown ifTrue:[ |
|
3903 | 1808 |
superView isPopUpView ifTrue:[ |
1809 |
superView hide |
|
1810 |
]. |
|
1864 | 1811 |
] |
1812 |
] |
|
1813 |
] |
|
1814 |
]. |
|
1815 |
self performSelectedAction. |
|
202 | 1816 |
]. |
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
463
diff
changeset
|
1817 |
|
497 | 1818 |
"/ |
1819 |
"/ not within mySelf |
|
1820 |
"/ |
|
1821 |
||
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
463
diff
changeset
|
1822 |
superMenu notNil ifTrue:[ |
1864 | 1823 |
hide := hideOnRelease. |
1824 |
hide ifFalse:[ |
|
3153
499fc16c974a
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
2975
diff
changeset
|
1825 |
superMenu shown ifFalse:[ |
1864 | 1826 |
superView notNil ifTrue:[ |
1827 |
superView shown ifTrue:[ |
|
1828 |
hide := true |
|
1829 |
] |
|
1830 |
] |
|
1831 |
]. |
|
1832 |
]. |
|
1833 |
hide ifTrue:[ |
|
1834 |
superView hide |
|
1835 |
]. |
|
202 | 1836 |
]. |
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
463
diff
changeset
|
1837 |
|
435 | 1838 |
"/ (superView notNil and:[superView isPopUpView]) ifTrue:[ |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1839 |
"/ 'refetch focus' printNL. |
435 | 1840 |
"/ superView regainControl. |
1841 |
"/ superView getKeyboardFocus. |
|
1842 |
"/ superView hide |
|
1843 |
"/ ] |
|
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1844 |
|
497 | 1845 |
"Modified: 8.3.1996 / 14:06:15 / cg" |
202 | 1846 |
! |
1847 |
||
1848 |
keyPress:aKey x:x y:y |
|
491 | 1849 |
|
1850 |
<resource: #keyboard (#Return #MenuSelect #Escape)> |
|
1851 |
||
202 | 1852 |
|m| |
1853 |
||
1854 |
subMenuShown notNil ifTrue:[ |
|
1860 | 1855 |
subMenuShown menuView keyPress:aKey x:0 y:0. |
1856 |
^ self |
|
202 | 1857 |
]. |
1858 |
||
1859 |
" |
|
1860 |
Return, space or the (virtual) MenuSelect |
|
1861 |
key trigger a selected entry. |
|
1862 |
" |
|
1863 |
(aKey == #Return |
|
1864 |
or:[aKey == #MenuSelect |
|
1865 |
or:[aKey == Character space]]) ifTrue:[ |
|
1860 | 1866 |
selection notNil ifTrue:[ |
1867 |
(subMenus notNil and:[(m := subMenus at:selection) notNil]) ifTrue:[ |
|
1868 |
self showSubmenu:selection. |
|
1869 |
m hideOnLeave:false |
|
1870 |
] ifFalse:[ |
|
1871 |
subMenuShown := nil. |
|
1872 |
self buttonRelease:2 x:0 y:0. |
|
1873 |
] |
|
1874 |
]. |
|
1875 |
^ self |
|
202 | 1876 |
]. |
317
f23de8b78f5e
Escape closes pullDownMenus & PopUpLists
Claus Gittinger <cg@exept.de>
parents:
269
diff
changeset
|
1877 |
aKey == #Escape ifTrue:[ |
1860 | 1878 |
masterView notNil ifTrue:[ |
1879 |
masterView hideSubmenu. |
|
2069 | 1880 |
"/ masterView regainControl. |
1860 | 1881 |
masterView hide. |
1882 |
]. |
|
1883 |
superView hide. |
|
1884 |
||
1885 |
^ self |
|
317
f23de8b78f5e
Escape closes pullDownMenus & PopUpLists
Claus Gittinger <cg@exept.de>
parents:
269
diff
changeset
|
1886 |
]. |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1887 |
aKey == #CursorRight ifTrue:[ |
1860 | 1888 |
selection notNil ifTrue:[ |
1889 |
(subMenus notNil and:[(m := subMenus at:selection) notNil]) ifTrue:[ |
|
1890 |
self showSubmenu:selection. |
|
1891 |
m hideOnLeave:false. |
|
1892 |
^ self |
|
1893 |
] |
|
1894 |
]. |
|
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1895 |
]. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1896 |
aKey == #CursorLeft ifTrue:[ |
1860 | 1897 |
masterView notNil ifTrue:[ |
1898 |
masterView hideSubmenu. |
|
1899 |
masterView regainControl. |
|
1900 |
]. |
|
1901 |
superView hide. |
|
1902 |
^ self |
|
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1903 |
]. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1904 |
|
202 | 1905 |
super keyPress:aKey x:x y:y |
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
463
diff
changeset
|
1906 |
|
1059 | 1907 |
"Modified: 25.2.1997 / 23:37:57 / cg" |
202 | 1908 |
! |
1909 |
||
1910 |
pointerLeave:state |
|
1911 |
subMenuShown notNil ifTrue:[ |
|
1860 | 1912 |
^ self |
202 | 1913 |
]. |
1914 |
"/ self setSelectionForX:-1 y:-1. "force deselect" |
|
1860 | 1915 |
self setSelection:nil |
202 | 1916 |
"/ superMenu notNil ifTrue:[ |
1917 |
"/ superMenu regainControl. |
|
1918 |
"/ ] |
|
683 | 1919 |
|
1920 |
"Modified: 25.5.1996 / 12:27:18 / cg" |
|
202 | 1921 |
! ! |
1922 |
||
2751 | 1923 |
!MenuView methodsFor:'initialization & release'! |
202 | 1924 |
|
1925 |
create |
|
1926 |
super create. |
|
1927 |
subMenuShown := nil. |
|
1928 |
self resizeIfChanged |
|
1929 |
! |
|
1930 |
||
1931 |
destroy |
|
1932 |
" |
|
1933 |
have to destroy the submenus manually here, |
|
1934 |
since they are no real subviews of myself |
|
1935 |
" |
|
1936 |
subMenus notNil ifTrue:[ |
|
1937 |
subMenus do:[:m | |
|
1938 |
m notNil ifTrue:[ |
|
1939 |
m destroy |
|
1940 |
] |
|
1941 |
]. |
|
1942 |
subMenus := nil |
|
1943 |
]. |
|
1944 |
super destroy. |
|
1945 |
! |
|
1946 |
||
939 | 1947 |
fetchDeviceResources |
1948 |
"fetch device colors, to avoid reallocation at redraw time" |
|
1949 |
||
1950 |
super fetchDeviceResources. |
|
1951 |
||
1989 | 1952 |
checkColor notNil ifTrue:[checkColor := checkColor onDevice:device]. |
1953 |
disabledFgColor notNil ifTrue:[disabledFgColor := disabledFgColor onDevice:device]. |
|
939 | 1954 |
|
3464 | 1955 |
hilightFgColorNoFocus := hilightFgColor. |
1956 |
hilightBgColorNoFocus := hilightBgColor. |
|
1957 |
||
939 | 1958 |
"Created: 14.1.1997 / 00:08:55 / cg" |
1959 |
! |
|
1960 |
||
202 | 1961 |
initEvents |
1962 |
super initEvents. |
|
1963 |
self enableLeaveEvents. |
|
3911
2e2c5429a2f9
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3903
diff
changeset
|
1964 |
self enableMotionEvents. |
495
d993f23ea658
fixed subMenus with a menuPerformer (now also behaves the ST-80 way)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1965 |
|
202 | 1966 |
windowGroup notNil ifTrue:[ |
3911
2e2c5429a2f9
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3903
diff
changeset
|
1967 |
windowGroup sensor compressMotionEvents:true |
202 | 1968 |
] |
495
d993f23ea658
fixed subMenus with a menuPerformer (now also behaves the ST-80 way)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1969 |
|
d993f23ea658
fixed subMenus with a menuPerformer (now also behaves the ST-80 way)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1970 |
"Modified: 7.3.1996 / 14:18:09 / cg" |
202 | 1971 |
! |
1972 |
||
1973 |
initStyle |
|
967 | 1974 |
"setup viewStyle specifics" |
1975 |
||
202 | 1976 |
|style| |
1977 |
||
1978 |
super initStyle. |
|
1979 |
||
392
81343306d796
eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents:
365
diff
changeset
|
1980 |
"/ DefaultFont notNil ifTrue:[font := DefaultFont on:device]. |
202 | 1981 |
|
1982 |
DefaultCheckColor notNil ifTrue:[ |
|
1989 | 1983 |
checkColor := DefaultCheckColor |
202 | 1984 |
] ifFalse:[ |
1989 | 1985 |
checkColor := fgColor. |
202 | 1986 |
]. |
939 | 1987 |
disabledFgColor := DefaultDisabledForegroundColor. |
2498 | 1988 |
disabledEtchedFgColor := DefaultDisabledEtchedForegroundColor. |
202 | 1989 |
|
1990 |
DefaultForegroundColor notNil ifTrue:[ |
|
1989 | 1991 |
fgColor := DefaultForegroundColor onDevice:device |
202 | 1992 |
]. |
1993 |
DefaultBackgroundColor notNil ifTrue:[ |
|
1989 | 1994 |
bgColor := DefaultBackgroundColor onDevice:device |
202 | 1995 |
]. |
1996 |
||
1997 |
DefaultShadowColor notNil ifTrue:[ |
|
1989 | 1998 |
shadowColor := DefaultShadowColor onDevice:device |
202 | 1999 |
]. |
2000 |
DefaultLightColor notNil ifTrue:[ |
|
1989 | 2001 |
lightColor := DefaultLightColor onDevice:device |
202 | 2002 |
]. |
2003 |
||
2004 |
DefaultHilightLevel notNil ifTrue:[ |
|
1989 | 2005 |
hilightLevel := DefaultHilightLevel |
202 | 2006 |
] ifFalse:[ |
1989 | 2007 |
hilightLevel := 0. |
202 | 2008 |
]. |
512 | 2009 |
"/ hilightStyle := DefaultHilightStyle. |
202 | 2010 |
|
2011 |
hilightFrameColor := DefaultHilightFrameColor. |
|
2012 |
||
2013 |
styleSheet is3D ifTrue:[ |
|
1989 | 2014 |
"some 3D style menu - set hilight defaults to same" |
2015 |
||
2016 |
DefaultHilightForegroundColor notNil ifTrue:[ |
|
2017 |
hilightFgColor := DefaultHilightForegroundColor onDevice:device |
|
2018 |
] ifFalse:[ |
|
2019 |
hilightFgColor := fgColor. |
|
2020 |
]. |
|
2021 |
DefaultHilightBackgroundColor notNil ifTrue:[ |
|
2022 |
hilightBgColor := DefaultHilightBackgroundColor onDevice:device |
|
2023 |
] ifFalse:[ |
|
2024 |
hilightBgColor := bgColor. |
|
2025 |
]. |
|
2026 |
DefaultLineLevel notNil ifTrue:[ |
|
2027 |
lineLevel := DefaultLineLevel |
|
2028 |
] ifFalse:[ |
|
2029 |
lineLevel := -1. |
|
2030 |
] |
|
202 | 2031 |
] ifFalse:[ |
1989 | 2032 |
"some 2D style menu - set hilight defaults to inverse" |
2033 |
DefaultHilightForegroundColor notNil ifTrue:[ |
|
2034 |
hilightFgColor := DefaultHilightForegroundColor onDevice:device |
|
2035 |
] ifFalse:[ |
|
2036 |
hilightFgColor := bgColor. |
|
2037 |
]. |
|
2038 |
DefaultHilightBackgroundColor notNil ifTrue:[ |
|
2039 |
hilightBgColor := DefaultHilightBackgroundColor onDevice:device |
|
2040 |
] ifFalse:[ |
|
2041 |
hilightBgColor := fgColor. |
|
2042 |
]. |
|
2043 |
DefaultLineLevel notNil ifTrue:[ |
|
2044 |
lineLevel := DefaultLineLevel |
|
2045 |
] ifFalse:[ |
|
2046 |
lineLevel := 0. |
|
2047 |
] |
|
202 | 2048 |
]. |
2049 |
||
2050 |
DefaultLineInset notNil ifTrue:[ |
|
1989 | 2051 |
lineInset := DefaultLineInset |
202 | 2052 |
] ifFalse:[ |
1989 | 2053 |
lineInset := (device horizontalPixelPerMillimeter * 0.8) rounded. |
202 | 2054 |
]. |
2055 |
||
2056 |
" |
|
2057 |
the following has to be changed to |
|
2058 |
use the styleSheet too |
|
2059 |
" |
|
2060 |
style := styleSheet name. |
|
2061 |
||
2062 |
(style == #iris) ifTrue:[ |
|
1989 | 2063 |
device hasGrayscales ifTrue:[ |
2064 |
lineSpacing := 3 |
|
2065 |
]. |
|
202 | 2066 |
]. |
2067 |
(style == #motif) ifTrue:[ |
|
1989 | 2068 |
lineSpacing := (2 * hilightLevel) |
202 | 2069 |
]. |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2070 |
"/ stupid - these are clobbered somewhere; see initialize and recreate |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2071 |
"/ hilightStyle == #openwin ifTrue:[ |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2072 |
"/ "add some space for rounded-hilight area" |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2073 |
"/ self leftMargin:(font height // 2 + 2 "inset of rounded rect") "10". |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2074 |
"/ ] ifFalse:[ |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2075 |
"/ (hilightLevel ~~ 0) ifTrue:[ |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2076 |
"/ self leftMargin:hilightLevel abs + self margin abs + 1. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2077 |
"/ lineSpacing := lineSpacing max:(hilightLevel abs * 2). |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2078 |
"/ ] |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2079 |
"/ ]. |
202 | 2080 |
(style == #st80) ifTrue:[ |
1989 | 2081 |
level := 0. |
202 | 2082 |
]. |
2083 |
DefaultViewBackground notNil ifTrue:[ |
|
1989 | 2084 |
viewBackground := DefaultViewBackground onDevice:device |
202 | 2085 |
]. |
2086 |
||
967 | 2087 |
"Modified: 22.1.1997 / 11:57:23 / cg" |
202 | 2088 |
! |
2089 |
||
2090 |
initialize |
|
2091 |
|style| |
|
2092 |
||
2093 |
super initialize. |
|
2094 |
hideOnRelease := false. |
|
2095 |
autoScroll := false. |
|
334 | 2096 |
sizeFixed := false. |
202 | 2097 |
|
2098 |
(((style := styleSheet name) ~~ #normal) |
|
2099 |
and:[style ~~ #mswindows]) ifTrue:[ |
|
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
2100 |
borderWidth := 1. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
2101 |
(style ~~ #st80) ifTrue:[self level:1] |
202 | 2102 |
]. |
2103 |
||
2104 |
"stupid - have to redo this ..." |
|
2105 |
hilightStyle == #openwin ifTrue:[ |
|
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
2106 |
"add some space for rounded-hilight area" |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
2107 |
self leftMargin:(font height " // 2" + 2 "inset of rounded rect") "10". |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2108 |
] ifFalse:[ |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
2109 |
(hilightLevel ~~ 0) ifTrue:[ |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
2110 |
self leftMargin:hilightLevel abs + margin abs + 1. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
2111 |
lineSpacing := lineSpacing max:(hilightLevel abs * 2). |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
2112 |
] |
202 | 2113 |
]. |
334 | 2114 |
|
751 | 2115 |
"Modified: 5.6.1996 / 14:36:56 / cg" |
202 | 2116 |
! |
2117 |
||
2118 |
recreate |
|
2258 | 2119 |
"when recreated after a snapin or a migration, resize myself, in case |
202 | 2120 |
font dimensions have changed on the display" |
2121 |
||
2122 |
super recreate. |
|
2123 |
hilightStyle == #openwin ifTrue:[ |
|
2258 | 2124 |
"add some space for rounded-hilight area" |
2125 |
self leftMargin:(font height // 2 + 2 "inset of rounded rect") "10". |
|
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2126 |
] ifFalse:[ |
2258 | 2127 |
(hilightLevel ~~ 0) ifTrue:[ |
2128 |
self leftMargin:hilightLevel abs + self margin abs + 1. |
|
2129 |
lineSpacing := lineSpacing max:(hilightLevel abs * 2). |
|
2130 |
] |
|
202 | 2131 |
]. |
2132 |
self resize |
|
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2133 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2134 |
"Modified: 28.2.1996 / 19:39:37 / cg" |
202 | 2135 |
! |
2136 |
||
2137 |
reinitialize |
|
2138 |
"this is called right after snapIn; |
|
2139 |
a kind of kludge - reset cursor (in case the save was |
|
2140 |
done with myself being shown and active)" |
|
2141 |
||
2142 |
super reinitialize. |
|
2143 |
selection := nil. "self selection:nil." |
|
2144 |
self showPassive |
|
0 | 2145 |
! ! |
2146 |
||
2147 |
!MenuView methodsFor:'private'! |
|
2148 |
||
7 | 2149 |
hideSubmenu |
1058
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
2150 |
"hide the currently shown subMenu (if any)" |
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
2151 |
|
1735
3f596be86a0d
care for nil id when unmapping
Claus Gittinger <cg@exept.de>
parents:
1649
diff
changeset
|
2152 |
|m id| |
1058
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
2153 |
|
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
2154 |
(m := subMenuShown) notNil ifTrue:[ |
1735
3f596be86a0d
care for nil id when unmapping
Claus Gittinger <cg@exept.de>
parents:
1649
diff
changeset
|
2155 |
"/ race condition kludge ... |
3f596be86a0d
care for nil id when unmapping
Claus Gittinger <cg@exept.de>
parents:
1649
diff
changeset
|
2156 |
m realized ifFalse:[ |
3f596be86a0d
care for nil id when unmapping
Claus Gittinger <cg@exept.de>
parents:
1649
diff
changeset
|
2157 |
(id := m id) notNil ifTrue:[ |
3f596be86a0d
care for nil id when unmapping
Claus Gittinger <cg@exept.de>
parents:
1649
diff
changeset
|
2158 |
device unmapWindow:id. |
3f596be86a0d
care for nil id when unmapping
Claus Gittinger <cg@exept.de>
parents:
1649
diff
changeset
|
2159 |
] |
3f596be86a0d
care for nil id when unmapping
Claus Gittinger <cg@exept.de>
parents:
1649
diff
changeset
|
2160 |
] ifTrue:[ |
3f596be86a0d
care for nil id when unmapping
Claus Gittinger <cg@exept.de>
parents:
1649
diff
changeset
|
2161 |
m hide. |
3f596be86a0d
care for nil id when unmapping
Claus Gittinger <cg@exept.de>
parents:
1649
diff
changeset
|
2162 |
]. |
3f596be86a0d
care for nil id when unmapping
Claus Gittinger <cg@exept.de>
parents:
1649
diff
changeset
|
2163 |
|
3f596be86a0d
care for nil id when unmapping
Claus Gittinger <cg@exept.de>
parents:
1649
diff
changeset
|
2164 |
subMenuShown := nil. |
3f596be86a0d
care for nil id when unmapping
Claus Gittinger <cg@exept.de>
parents:
1649
diff
changeset
|
2165 |
self setSelection:nil. |
7 | 2166 |
]. |
497 | 2167 |
|
1059 | 2168 |
"Modified: 25.2.1997 / 23:38:50 / cg" |
7 | 2169 |
! |
2170 |
||
202 | 2171 |
isCheckItem:line |
1919
7752e8980de5
allow for \\ to allow the single \ to be displayed (DOS filenames)
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2172 |
"return true if \c, \b or \t is contained in the line arg. |
7752e8980de5
allow for \\ to allow the single \ to be displayed (DOS filenames)
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2173 |
Care for '\\'." |
7752e8980de5
allow for \\ to allow the single \ to be displayed (DOS filenames)
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2174 |
|
7752e8980de5
allow for \\ to allow the single \ to be displayed (DOS filenames)
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2175 |
|idx| |
7752e8980de5
allow for \\ to allow the single \ to be displayed (DOS filenames)
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2176 |
|
3294
a3266e46b191
handle nonString items correctly
Stefan Vogel <sv@exept.de>
parents:
3153
diff
changeset
|
2177 |
line isString ifTrue:[ |
1919
7752e8980de5
allow for \\ to allow the single \ to be displayed (DOS filenames)
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2178 |
idx := 1. |
7752e8980de5
allow for \\ to allow the single \ to be displayed (DOS filenames)
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2179 |
[idx ~~ 0] whileTrue:[ |
7752e8980de5
allow for \\ to allow the single \ to be displayed (DOS filenames)
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2180 |
idx := line indexOf:$\ startingAt:idx. |
7752e8980de5
allow for \\ to allow the single \ to be displayed (DOS filenames)
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2181 |
(idx ~~ 0) ifTrue:[ |
7752e8980de5
allow for \\ to allow the single \ to be displayed (DOS filenames)
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2182 |
idx < line size ifTrue:[ |
7752e8980de5
allow for \\ to allow the single \ to be displayed (DOS filenames)
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2183 |
('cbt' includes:(line at:(idx+1))) ifTrue:[ |
7752e8980de5
allow for \\ to allow the single \ to be displayed (DOS filenames)
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2184 |
^ true |
7752e8980de5
allow for \\ to allow the single \ to be displayed (DOS filenames)
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2185 |
]. |
7752e8980de5
allow for \\ to allow the single \ to be displayed (DOS filenames)
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2186 |
]. |
7752e8980de5
allow for \\ to allow the single \ to be displayed (DOS filenames)
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2187 |
idx := idx + 2. |
7752e8980de5
allow for \\ to allow the single \ to be displayed (DOS filenames)
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2188 |
]. |
7752e8980de5
allow for \\ to allow the single \ to be displayed (DOS filenames)
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2189 |
]. |
202 | 2190 |
]. |
2191 |
^ false. |
|
405
39b9b0f04ccc
allow checkmarks at any position
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
2192 |
|
1919
7752e8980de5
allow for \\ to allow the single \ to be displayed (DOS filenames)
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2193 |
"Modified: / 31.5.1999 / 12:59:07 / cg" |
119 | 2194 |
! |
2195 |
||
202 | 2196 |
isGraphicItem:line |
2197 |
(line = '-') ifTrue:[^ true]. |
|
2198 |
(line = '=') ifTrue:[^ true]. |
|
2199 |
(line = '') ifTrue:[^ true]. |
|
2200 |
^ false. |
|
127 | 2201 |
! |
119 | 2202 |
|
2973 | 2203 |
labelWithoutDoubleAmpersands:label |
3294
a3266e46b191
handle nonString items correctly
Stefan Vogel <sv@exept.de>
parents:
3153
diff
changeset
|
2204 |
(label isString and:[label includesString:'&&']) ifTrue:[ |
a3266e46b191
handle nonString items correctly
Stefan Vogel <sv@exept.de>
parents:
3153
diff
changeset
|
2205 |
^ label copyReplaceString:'&&' withString:'&' |
a3266e46b191
handle nonString items correctly
Stefan Vogel <sv@exept.de>
parents:
3153
diff
changeset
|
2206 |
] ifFalse:[ |
a3266e46b191
handle nonString items correctly
Stefan Vogel <sv@exept.de>
parents:
3153
diff
changeset
|
2207 |
^ label |
a3266e46b191
handle nonString items correctly
Stefan Vogel <sv@exept.de>
parents:
3153
diff
changeset
|
2208 |
]. |
2973 | 2209 |
! |
2210 |
||
463 | 2211 |
performSelectedAction |
878 | 2212 |
|theSelector theAction isCheck checkOn val idx didItHere| |
463 | 2213 |
|
2069 | 2214 |
(superView notNil and:[superView isPopUpView]) ifTrue:[superView hideForAction]. |
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
463
diff
changeset
|
2215 |
superMenu notNil ifTrue:[superMenu submenuTriggered]. |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
463
diff
changeset
|
2216 |
|
517
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
2217 |
idx := selection. |
fc4ed55dcd35
added action-blocks (per menu item)
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
2218 |
idx notNil ifTrue:[ |
878 | 2219 |
|
2069 | 2220 |
(subMenus isNil or:[(subMenus at:idx) isNil]) ifTrue:[ |
2221 |
didItHere := false. |
|
2222 |
||
2223 |
self showActive. |
|
2224 |
[ |
|
2225 |
superMenu notNil ifTrue:[ |
|
2226 |
superMenu showActive |
|
2227 |
]. |
|
2228 |
||
2229 |
val := idx. |
|
2230 |
args notNil ifTrue:[ |
|
2231 |
val := args at:idx |
|
2232 |
]. |
|
2233 |
||
2234 |
isCheck := false. |
|
2235 |
onOffFlags notNil ifTrue:[ |
|
2236 |
onOffFlags size >= idx ifTrue:[ |
|
2237 |
checkOn := (onOffFlags at:idx). |
|
2238 |
isCheck := checkOn notNil. |
|
2239 |
isCheck ifTrue:[ |
|
2240 |
checkOn := val := checkOn not. |
|
2241 |
onOffFlags at:idx put:checkOn. |
|
2242 |
] |
|
2243 |
] |
|
2244 |
]. |
|
2245 |
||
2246 |
" |
|
2247 |
ST-80 style model notification |
|
2248 |
" |
|
2249 |
self sendChangeMessageWith:val. |
|
2250 |
||
2251 |
" |
|
2252 |
item actions or selectors-array |
|
2253 |
" |
|
2254 |
device activePointerGrab == self ifTrue:[ |
|
2255 |
device ungrabPointer. |
|
2256 |
]. |
|
2257 |
||
2258 |
actions notNil ifTrue:[ |
|
2259 |
theAction := actions at:idx ifAbsent:nil. |
|
2260 |
]. |
|
2261 |
||
2262 |
theAction isNil ifTrue: [ |
|
2263 |
selectors notNil ifTrue: [ |
|
2264 |
||
2265 |
"/ selectors may be: |
|
2266 |
"/ - a single selector used for all items |
|
2267 |
"/ - an array of selectors used per item |
|
2268 |
||
2269 |
selectors isSymbol ifTrue:[ |
|
2270 |
theSelector := selectors |
|
2271 |
] ifFalse:[ |
|
2272 |
(idx notNil |
|
2273 |
and:[idx <= selectors size]) ifTrue:[ |
|
2274 |
theSelector := selectors at:idx |
|
2275 |
] |
|
2276 |
]. |
|
2277 |
]. |
|
2278 |
]. |
|
2279 |
||
2280 |
(theSelector notNil |
|
2281 |
or:[theAction notNil]) ifTrue:[ |
|
2282 |
AbortSignal handle:[:ex | |
|
2283 |
ex return |
|
2284 |
] do:[ |
|
2285 |
|theReceiver| |
|
2286 |
||
2287 |
didItHere := true. |
|
2288 |
theAction notNil ifTrue:[ |
|
2502
8f5b721ac183
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2498
diff
changeset
|
2289 |
theAction valueWithOptionalArgument:val |
2069 | 2290 |
] ifFalse:[ |
2291 |
"/ support for ST-80 style message splitting: |
|
2292 |
"/ if there is a menuPerformer it gets the |
|
2293 |
"/ message (if understood). |
|
2294 |
"/ Otherwise if there is a model, try that. |
|
2295 |
"/ Finally, if there is a receiver, |
|
2296 |
"/ its sent to that one. |
|
2297 |
||
2298 |
theReceiver := menuPerformer. |
|
2299 |
(theReceiver isNil |
|
2300 |
or:[(theReceiver respondsTo:theSelector) not]) |
|
2301 |
ifTrue:[ |
|
2302 |
theReceiver := model. |
|
2303 |
]. |
|
2304 |
(theReceiver isNil |
|
2305 |
or:[(theReceiver respondsTo:theSelector) not]) |
|
2306 |
ifTrue:[ |
|
2307 |
theReceiver := receiver. |
|
2308 |
]. |
|
2309 |
||
2683 | 2310 |
theSelector isArray ifTrue:[ |
2311 |
theReceiver perform:(theSelector first) withArguments:(theSelector copyFrom:2) |
|
2069 | 2312 |
] ifFalse:[ |
2683 | 2313 |
theSelector numArgs == 0 ifTrue:[ |
2314 |
theReceiver perform:theSelector |
|
2315 |
] ifFalse:[ |
|
2316 |
isCheck ifTrue:[ |
|
2317 |
self redrawLine:idx. |
|
2318 |
val := checkOn. |
|
2319 |
]. |
|
2320 |
||
2321 |
theReceiver perform:theSelector with:val |
|
2322 |
] |
|
2069 | 2323 |
] |
2324 |
] |
|
2325 |
||
2326 |
] |
|
2327 |
]. |
|
2328 |
||
2329 |
" |
|
2330 |
any action-block ? |
|
2331 |
" |
|
2332 |
actionBlock notNil ifTrue:[ |
|
2333 |
AbortSignal handle:[:ex | |
|
2334 |
ex return |
|
2335 |
] do:[ |
|
2336 |
didItHere ifTrue:[ |
|
2337 |
val := nil |
|
2338 |
]. |
|
2339 |
actionBlock numArgs == 1 ifTrue:[ |
|
2340 |
actionBlock value:val |
|
2341 |
] ifFalse:[ |
|
2342 |
actionBlock value:self value:val |
|
2343 |
] |
|
2344 |
] |
|
2345 |
]. |
|
2346 |
||
2521
ca205c023cc1
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
2502
diff
changeset
|
2347 |
] ensure:[ |
2069 | 2348 |
realized ifTrue:[ |
2349 |
self showPassive. |
|
2350 |
]. |
|
2351 |
superMenu notNil ifTrue:[ |
|
2352 |
superMenu showPassive |
|
2353 |
] |
|
2354 |
]. |
|
2355 |
]. |
|
463 | 2356 |
] |
2357 |
||
2358 |
"Created: 4.3.1996 / 11:19:22 / cg" |
|
963 | 2359 |
"Modified: 21.1.1997 / 15:42:52 / cg" |
463 | 2360 |
! |
2361 |
||
127 | 2362 |
recomputeSize |
2363 |
"resize myself to my preferred size |
|
2364 |
OBSOLETE - use resize" |
|
2365 |
||
2366 |
self resize. |
|
0 | 2367 |
! |
2368 |
||
202 | 2369 |
resize |
2370 |
"resize myself to my preferred size" |
|
77 | 2371 |
|
337 | 2372 |
sizeFixed == true ifFalse:[ |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
2373 |
widthOfWidestLine := nil. "/ i.e. unknown |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
2374 |
super resize. |
334 | 2375 |
] |
2376 |
||
337 | 2377 |
"Modified: 9.2.1996 / 02:42:32 / cg" |
202 | 2378 |
! |
77 | 2379 |
|
202 | 2380 |
resizeIfChanged |
2381 |
needResize == true ifTrue:[ |
|
2382 |
self resize. |
|
2383 |
needResize := false |
|
2384 |
] |
|
77 | 2385 |
! |
2386 |
||
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
463
diff
changeset
|
2387 |
selectionChangedFrom:oldSelection |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
463
diff
changeset
|
2388 |
|
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
463
diff
changeset
|
2389 |
"Created: 4.3.1996 / 22:10:54 / cg" |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
463
diff
changeset
|
2390 |
! |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
463
diff
changeset
|
2391 |
|
0 | 2392 |
setSelectionForX:x y:y |
77 | 2393 |
"select whatever is under x/y coordinate - if there is |
2394 |
a subMenu, show it" |
|
2395 |
||
1627
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2396 |
<resource: #style (#'menu.subMenuPopInRightHalfOnly')> |
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2397 |
|
133 | 2398 |
|newSelection subMenu| |
0 | 2399 |
|
38 | 2400 |
(x < 0 |
2401 |
or:[x >= width |
|
2402 |
or:[y < 0 |
|
2403 |
or:[y >= height]]]) ifTrue:[ |
|
1627
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2404 |
" |
1860 | 2405 |
moved outside |
1627
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2406 |
" |
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2407 |
subMenuShown notNil ifTrue:[ |
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2408 |
^ self |
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2409 |
]. |
1860 | 2410 |
|
1627
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2411 |
superMenu notNil ifTrue:[ |
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2412 |
superMenu regainControl |
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2413 |
]. |
38 | 2414 |
]. |
2415 |
||
0 | 2416 |
newSelection := self positionToSelectionX:x y:y. |
7 | 2417 |
newSelection ~= selection ifTrue:[ |
1627
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2418 |
newSelection notNil ifTrue:[ |
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2419 |
(enableFlags at:newSelection) ifFalse:[ |
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2420 |
newSelection := nil |
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2421 |
] |
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2422 |
]. |
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2423 |
|
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2424 |
subMenuShown notNil ifTrue:[ |
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2425 |
self hideSubmenu. |
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2426 |
]. |
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2427 |
|
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2428 |
self setSelection:newSelection. |
133 | 2429 |
]. |
7 | 2430 |
|
133 | 2431 |
subMenu := nil. |
2432 |
selection notNil ifTrue:[ |
|
1627
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2433 |
subMenus notNil ifTrue:[ |
1864 | 2434 |
((styleSheet at:#'menu.subMenuPopInRightHalfOnly' default:false) not |
1627
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2435 |
or:[x > (width // 2)]) ifTrue:[ |
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2436 |
subMenu := (subMenus at:selection) |
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2437 |
] |
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2438 |
] |
133 | 2439 |
]. |
2440 |
subMenu notNil ifTrue:[ |
|
1627
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2441 |
self showSubmenu:selection. |
133 | 2442 |
] ifFalse:[ |
1627
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2443 |
subMenuShown notNil ifTrue:[ |
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2444 |
self hideSubmenu. |
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2445 |
]. |
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2446 |
subMenuShown := nil |
1864 | 2447 |
]. |
497 | 2448 |
|
1627
38d58b70124e
style option: submenu pops up everywhere in item or
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
2449 |
"Modified: / 29.7.1998 / 23:36:25 / cg" |
131 | 2450 |
! |
2451 |
||
202 | 2452 |
showSubmenu:index |
2453 |
"show subMenu at index" |
|
2454 |
||
2455 |
|org mx my m| |
|
2456 |
||
2457 |
m := subMenus at:index. |
|
2458 |
m isNil ifTrue:[^ self]. |
|
2459 |
m == subMenuShown ifTrue:[^ self]. |
|
2460 |
||
2461 |
mx := width - 5. |
|
2462 |
my := self yOfVisibleLine:index. |
|
2463 |
" |
|
2464 |
need to know the physical screen coordinate, |
|
2465 |
to map the subview there |
|
2466 |
" |
|
2434
a9b9d8f2ab5b
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
2467 |
org := device translatePoint:(mx @ my) fromView:self toView:nil. |
495
d993f23ea658
fixed subMenus with a menuPerformer (now also behaves the ST-80 way)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
2468 |
|
202 | 2469 |
" |
2470 |
before showing, process all of my expose events |
|
2471 |
" |
|
1058
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
2472 |
"/ "/ mhmh - is this still needed ? |
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
2473 |
"/ windowGroup notNil ifTrue:[ |
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
2474 |
"/ windowGroup processExposeEvents |
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
2475 |
"/ ]. |
202 | 2476 |
|
942
c1d77499d128
fixed submenu showing with mutliple displays
Claus Gittinger <cg@exept.de>
parents:
939
diff
changeset
|
2477 |
m topView device:device. "/ req'd for multiDisplay operation |
202 | 2478 |
m superMenu:self. |
131 | 2479 |
|
495
d993f23ea658
fixed subMenus with a menuPerformer (now also behaves the ST-80 way)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
2480 |
actionBlock notNil ifTrue:[ |
1860 | 2481 |
"/ mhmh - I am an ST-80 style menu |
2482 |
"/ which does not send any messages to the receiver, |
|
2483 |
"/ but returns the selector instead. |
|
2484 |
"/ let my submenu do so as well ... |
|
2485 |
||
2486 |
m menuView action:actionBlock |
|
495
d993f23ea658
fixed subMenus with a menuPerformer (now also behaves the ST-80 way)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
2487 |
]. |
d993f23ea658
fixed subMenus with a menuPerformer (now also behaves the ST-80 way)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
2488 |
|
202 | 2489 |
" |
2490 |
realize the submenu in MY windowgroup |
|
2491 |
" |
|
2492 |
windowGroup notNil ifTrue:[ |
|
1860 | 2493 |
m windowGroup:windowGroup. |
2494 |
windowGroup addTopView:m. |
|
202 | 2495 |
]. |
2496 |
m fixSize. |
|
2497 |
m origin:org. |
|
2498 |
m makeFullyVisible. |
|
2499 |
m noShadow. |
|
3464 | 2500 |
m haveControl:true. "/ grap pointers during mapped |
1058
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
2501 |
|
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
2502 |
"/ race condition kludge ... |
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
2503 |
m realized ifFalse:[ |
1860 | 2504 |
m realize. |
1058
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
2505 |
] ifTrue:[ |
1860 | 2506 |
device mapWindow:m id. |
1058
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
2507 |
]. |
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
2508 |
"/ device flush. |
202 | 2509 |
subMenuShown := m |
495
d993f23ea658
fixed subMenus with a menuPerformer (now also behaves the ST-80 way)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
2510 |
|
2434
a9b9d8f2ab5b
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
2511 |
"Modified: / 10.10.2001 / 14:12:44 / cg" |
0 | 2512 |
! ! |
2513 |
||
202 | 2514 |
!MenuView methodsFor:'queries'! |
0 | 2515 |
|
202 | 2516 |
preferredExtent |
969 | 2517 |
"compute & return my preferredExtent from labels width's" |
2518 |
||
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2519 |
|margin2 w h extra| |
202 | 2520 |
|
3752
9c3b292df738
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3551
diff
changeset
|
2521 |
"/ If I have an explicit preferredExtent.. |
9c3b292df738
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3551
diff
changeset
|
2522 |
explicitExtent notNil ifTrue:[ |
9c3b292df738
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3551
diff
changeset
|
2523 |
^ explicitExtent |
9c3b292df738
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3551
diff
changeset
|
2524 |
]. |
9c3b292df738
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3551
diff
changeset
|
2525 |
|
9c3b292df738
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3551
diff
changeset
|
2526 |
"/ If I have a cached preferredExtent value.. |
714
5ff02d2d9fa7
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
709
diff
changeset
|
2527 |
preferredExtent notNil ifTrue:[ |
3752
9c3b292df738
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3551
diff
changeset
|
2528 |
^ preferredExtent |
714
5ff02d2d9fa7
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
709
diff
changeset
|
2529 |
]. |
5ff02d2d9fa7
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
709
diff
changeset
|
2530 |
|
202 | 2531 |
widthOfWidestLine := nil. "/ i.e. unknown |
119 | 2532 |
|
202 | 2533 |
margin2 := margin * 2. |
2534 |
w := self widthOfContents + leftMargin + leftMargin + margin2. |
|
2535 |
h := (self numberOfLines) * fontHeight - lineSpacing + (2 * topMargin) + margin2. |
|
228 | 2536 |
hilightLevel ~~ 0 ifTrue:[ |
3752
9c3b292df738
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3551
diff
changeset
|
2537 |
h := h + (hilightLevel abs) |
224 | 2538 |
]. |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2539 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2540 |
extra := 0. |
202 | 2541 |
"if there is a submenu, add some space for the right arrow" |
2542 |
subMenus notNil ifTrue:[ |
|
3752
9c3b292df738
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3551
diff
changeset
|
2543 |
extra := 16 |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2544 |
]. |
461
45282807f7fa
handle shortKey & submenu-arrow in one line; allow turning of of accelerator display
Claus Gittinger <cg@exept.de>
parents:
460
diff
changeset
|
2545 |
((ShowAcceleratorKeys ~~ false) and:[shortKeys notNil]) ifTrue:[ |
3752
9c3b292df738
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3551
diff
changeset
|
2546 |
extra := extra max:(self shortKeyInset) + 10 "/ spacing |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2547 |
]. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2548 |
^ ((w+extra) @ h). |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2549 |
|
969 | 2550 |
"Modified: 23.1.1997 / 02:36:17 / cg" |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2551 |
! |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2552 |
|
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
2553 |
selectedItemHasSubmenu |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
2554 |
selection isNil ifTrue:[^false]. |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
2555 |
^ (subMenus notNil and:[(subMenus at:selection) notNil]). |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
2556 |
|
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
2557 |
"Modified: 20.11.1997 / 00:07:50 / cg" |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
2558 |
! |
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
2559 |
|
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2560 |
shortKeyInset |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2561 |
"compute the width req'd for the shortKey" |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2562 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2563 |
maxShortKeyStringLen isNil ifTrue:[ |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2564 |
|
3323
ce80842d41e0
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
3294
diff
changeset
|
2565 |
shortKeys isNil ifTrue:[ |
ce80842d41e0
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
3294
diff
changeset
|
2566 |
maxShortKeyStringLen := 0 |
ce80842d41e0
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
3294
diff
changeset
|
2567 |
] ifFalse:[ |
ce80842d41e0
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
3294
diff
changeset
|
2568 |
maxShortKeyStringLen := shortKeys |
ce80842d41e0
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
3294
diff
changeset
|
2569 |
inject:0 |
ce80842d41e0
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
3294
diff
changeset
|
2570 |
into:[:maxSoFar :thisKey | |short| |
ce80842d41e0
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
3294
diff
changeset
|
2571 |
|
ce80842d41e0
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
3294
diff
changeset
|
2572 |
thisKey isNil ifTrue:[ |
ce80842d41e0
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
3294
diff
changeset
|
2573 |
maxSoFar |
ce80842d41e0
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
3294
diff
changeset
|
2574 |
] ifFalse:[ |
ce80842d41e0
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
3294
diff
changeset
|
2575 |
short := device shortKeyStringFor:thisKey. |
ce80842d41e0
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
3294
diff
changeset
|
2576 |
short isNil ifTrue:[ |
ce80842d41e0
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
3294
diff
changeset
|
2577 |
maxSoFar |
ce80842d41e0
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
3294
diff
changeset
|
2578 |
] ifFalse:[ |
ce80842d41e0
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
3294
diff
changeset
|
2579 |
maxSoFar max:(font widthOf:short) |
ce80842d41e0
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
3294
diff
changeset
|
2580 |
] |
ce80842d41e0
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
3294
diff
changeset
|
2581 |
] |
ce80842d41e0
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
3294
diff
changeset
|
2582 |
] |
ce80842d41e0
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
3294
diff
changeset
|
2583 |
]. |
202 | 2584 |
]. |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2585 |
^ maxShortKeyStringLen |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2586 |
|
3323
ce80842d41e0
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
3294
diff
changeset
|
2587 |
"Created: / 28-02-1996 / 16:30:09 / cg" |
ce80842d41e0
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
3294
diff
changeset
|
2588 |
"Modified: / 08-08-2006 / 15:47:07 / cg" |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2589 |
! |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2590 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2591 |
shortKeyPrefixFor:aModifier |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2592 |
|m| |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2593 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2594 |
"/ aModifier = 'Alt' ifTrue:[ |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2595 |
"/ ^ '@-' |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2596 |
"/ ]. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2597 |
"/ aModifier = 'Cmd' ifTrue:[ |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2598 |
"/ ^ '@-' |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2599 |
"/ ]. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2600 |
"/ aModifier = 'Meta' ifTrue:[ |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2601 |
"/ ^ '$-' |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2602 |
"/ ]. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2603 |
"/ aModifier = 'Ctrl' ifTrue:[ |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2604 |
"/ ^ '^-' |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2605 |
"/ ]. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2606 |
"/ ^ aModifier. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2607 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2608 |
m := device modifierKeyTopFor:aModifier. |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2609 |
m notNil ifTrue:[ |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
2610 |
^ m , '-' |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2611 |
]. |
508 | 2612 |
^ aModifier. |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2613 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2614 |
"Created: 28.2.1996 / 16:32:17 / cg" |
508 | 2615 |
"Modified: 20.3.1996 / 17:03:34 / cg" |
77 | 2616 |
! ! |
2617 |
||
0 | 2618 |
!MenuView methodsFor:'redrawing'! |
2619 |
||
202 | 2620 |
redrawFromVisibleLine:start to:stop |
2621 |
"redraw a line range - redefined to care for special entries." |
|
2622 |
||
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2623 |
"/ the natural way to do it is: |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2624 |
"/ |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2625 |
"/ start to:stop do:[:visLine | |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2626 |
"/ self redrawVisibleLine:visLine |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2627 |
"/ ] |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2628 |
"/ |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2629 |
"/ but I want to draw the stuff in big chunks for slow machines ... |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2630 |
"/ Q: is it worth it ? |
191
5ccbde40bb6b
draw strings half a lineSpacing lower - highlight frames look better
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
2631 |
|
202 | 2632 |
|first |
2633 |
index "{ Class: SmallInteger }" |
|
2634 |
current "{ Class: SmallInteger }" |
|
2635 |
line special index0| |
|
2636 |
||
2637 |
index0 := self visibleLineToListLine:start. |
|
2638 |
index0 notNil ifTrue:[ |
|
2959 | 2639 |
index := index0. |
2640 |
first := start. |
|
2641 |
current := start. |
|
2642 |
[current <= stop] whileTrue:[ |
|
2643 |
line := self visibleAt:current. |
|
2644 |
line notNil ifTrue:[ |
|
2645 |
line isText ifFalse:[ |
|
2960 | 2646 |
line := line asString string |
2959 | 2647 |
] |
2648 |
]. |
|
2649 |
||
2650 |
special := line notNil |
|
2651 |
and:[line isString |
|
2652 |
and:[(self isGraphicItem:line) |
|
2653 |
or:[line includes:$\ ]]]. |
|
2654 |
||
2655 |
(special |
|
2656 |
or:[shortKeys notNil |
|
2657 |
or:[(enableFlags at:index) not]]) ifTrue:[ |
|
2658 |
"a special case" |
|
2659 |
(first < current) ifTrue:[ |
|
2660 |
super redrawFromVisibleLine:first to:(current - 1) |
|
2661 |
]. |
|
2662 |
self redrawVisibleLine:current. |
|
2663 |
first := current + 1 |
|
2664 |
]. |
|
2665 |
current := current + 1. |
|
2666 |
index := index + 1 |
|
2667 |
]. |
|
2668 |
(first < current) ifTrue:[ |
|
2669 |
super redrawFromVisibleLine:first to:(current - 1) |
|
2670 |
]. |
|
2671 |
||
2672 |
"draw submenu marks" |
|
2673 |
subMenus notNil ifTrue:[ |
|
2674 |
index := index0. |
|
2675 |
start to:stop do:[:l | |
|
2676 |
index <= subMenus size ifTrue:[ |
|
2677 |
(subMenus at:index) notNil ifTrue:[ |
|
2678 |
self drawRightArrowInVisibleLine:l |
|
2679 |
]. |
|
2680 |
index := index + 1 |
|
2681 |
] |
|
2682 |
] |
|
2683 |
] |
|
202 | 2684 |
] |
405
39b9b0f04ccc
allow checkmarks at any position
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
2685 |
|
635
cb2ac261994b
handle non-string items better
Claus Gittinger <cg@exept.de>
parents:
624
diff
changeset
|
2686 |
"Modified: 12.5.1996 / 21:13:31 / cg" |
0 | 2687 |
! |
2688 |
||
2689 |
redrawVisibleLine:visLineNr |
|
63 | 2690 |
"redefined from normal list-line drawing, to handle special |
2691 |
lines. These are: |
|
2498 | 2692 |
lines consisting of '-' only: draw a horizontal separating line |
2693 |
lines consisting of '=' only: draw double separating line |
|
2694 |
empty line : leave blank |
|
63 | 2695 |
there may be more in the future. |
2696 |
" |
|
2697 |
||
2698 |
|line lineNr y isSpecial isSeparatingLine |
|
2572
9b09dd9d9dae
dont forget to draw accelerator when disabled
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
2699 |
isDoubleLine right clr1 clr2 text key| |
0 | 2700 |
|
2701 |
line := self visibleAt:visLineNr. |
|
2702 |
||
63 | 2703 |
isSpecial := isDoubleLine := isSeparatingLine := false. |
0 | 2704 |
(line = '-') ifTrue:[ |
2498 | 2705 |
isSeparatingLine := isSpecial := true. |
0 | 2706 |
] ifFalse:[ |
2498 | 2707 |
(line = '=') ifTrue:[ |
2708 |
isSeparatingLine := isSpecial := isDoubleLine := true. |
|
2709 |
] ifFalse:[ |
|
2710 |
(line = '') ifTrue:[ |
|
2711 |
isSpecial := true |
|
2712 |
] |
|
2713 |
] |
|
0 | 2714 |
]. |
63 | 2715 |
|
0 | 2716 |
isSpecial ifFalse:[ |
2498 | 2717 |
lineNr := self visibleLineToListLine:visLineNr. |
2718 |
(enableFlags at:lineNr) ifFalse:[ |
|
2719 |
text := self visibleAt:visLineNr. |
|
2720 |
disabledEtchedFgColor notNil ifTrue:[ |
|
2721 |
text := text asText emphasisAllAdd:(#etchColor -> disabledEtchedFgColor) |
|
2722 |
]. |
|
2723 |
self |
|
2724 |
drawLine:text |
|
2725 |
atX:(textStartLeft - viewOrigin x) |
|
2726 |
inVisible:visLineNr |
|
2727 |
with:disabledFgColor |
|
2728 |
and:bgColor. |
|
2572
9b09dd9d9dae
dont forget to draw accelerator when disabled
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
2729 |
|
9b09dd9d9dae
dont forget to draw accelerator when disabled
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
2730 |
"/ |
9b09dd9d9dae
dont forget to draw accelerator when disabled
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
2731 |
"/ is there a shortKey ? |
9b09dd9d9dae
dont forget to draw accelerator when disabled
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
2732 |
"/ |
9b09dd9d9dae
dont forget to draw accelerator when disabled
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
2733 |
((ShowAcceleratorKeys ~~ false) |
9b09dd9d9dae
dont forget to draw accelerator when disabled
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
2734 |
and:[shortKeys notNil |
9b09dd9d9dae
dont forget to draw accelerator when disabled
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
2735 |
and:[(key := shortKeys at:lineNr ifAbsent:nil) notNil]]) ifTrue:[ |
9b09dd9d9dae
dont forget to draw accelerator when disabled
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
2736 |
self drawAccelerator:key inVisibleLine:visLineNr with:disabledFgColor and:bgColor |
9b09dd9d9dae
dont forget to draw accelerator when disabled
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
2737 |
] |
2498 | 2738 |
"/ self drawVisibleLine:visLineNr with:disabledFgColor and:bgColor |
2739 |
] ifTrue:[ |
|
2740 |
super redrawVisibleLine:visLineNr |
|
2741 |
]. |
|
2742 |
||
2743 |
"/ |
|
2744 |
"/ is there a submenu ? |
|
2745 |
"/ |
|
2746 |
(subMenus notNil and:[(subMenus at:lineNr ifAbsent:nil) notNil]) ifTrue:[ |
|
2747 |
self drawRightArrowInVisibleLine:visLineNr |
|
2748 |
]. |
|
2749 |
^ self |
|
0 | 2750 |
]. |
2751 |
||
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2752 |
"/ |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2753 |
"/ handle separating lines |
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2754 |
"/ |
0 | 2755 |
|
59 | 2756 |
y := self yOfVisibleLine:visLineNr. |
38 | 2757 |
|
2758 |
self paint:bgColor. |
|
2759 |
self fillRectangleX:0 y:y width:width height:fontHeight. |
|
2760 |
||
0 | 2761 |
isSeparatingLine ifTrue:[ |
2498 | 2762 |
y := y + (fontHeight // 2). |
2763 |
isDoubleLine ifTrue:[ |
|
2764 |
y := y - (fontHeight // 8). |
|
2765 |
]. |
|
2766 |
||
2767 |
right := width - 1 - lineInset. |
|
2768 |
||
2769 |
lineLevel == 0 ifTrue:[ |
|
2770 |
self paint:fgColor. |
|
2771 |
self displayLineFromX:lineInset y:y toX:right y:y. |
|
2772 |
isDoubleLine ifTrue:[ |
|
2773 |
y := y + (fontHeight // 4). |
|
2774 |
self displayLineFromX:lineInset y:y toX:right y:y |
|
2775 |
] |
|
2776 |
] ifFalse:[ |
|
2777 |
"the inset on each side" |
|
2778 |
||
2779 |
lineLevel < 0 ifTrue:[ |
|
2780 |
clr1 := shadowColor. |
|
2781 |
clr2 := lightColor. |
|
2782 |
] ifFalse:[ |
|
2783 |
clr1 := lightColor. |
|
2784 |
clr2 := shadowColor. |
|
2785 |
]. |
|
2786 |
||
2787 |
self paint:clr1. |
|
2788 |
self displayLineFromX:lineInset y:y toX:right y:y. |
|
2789 |
self paint:clr2. |
|
2790 |
y := y + 1. |
|
2791 |
self displayLineFromX:lineInset y:y toX:right y:y. |
|
2792 |
isDoubleLine ifTrue:[ |
|
2793 |
y := y + (fontHeight // 4). |
|
2794 |
self displayLineFromX:lineInset y:y toX:right y:y. |
|
2795 |
y := y - 1. |
|
2796 |
self paint:clr1. |
|
2797 |
self displayLineFromX:lineInset y:y toX:right y:y. |
|
2798 |
] |
|
2799 |
] |
|
0 | 2800 |
] |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2801 |
|
461
45282807f7fa
handle shortKey & submenu-arrow in one line; allow turning of of accelerator display
Claus Gittinger <cg@exept.de>
parents:
460
diff
changeset
|
2802 |
"Modified: 2.3.1996 / 14:48:08 / cg" |
0 | 2803 |
! |
2804 |
||
202 | 2805 |
redrawVisibleLine:visLine col:col |
2806 |
"redefined to always draw a full line - for openwin handling" |
|
0 | 2807 |
|
202 | 2808 |
self redrawVisibleLine:visLine |
2809 |
! |
|
97 | 2810 |
|
202 | 2811 |
redrawVisibleLine:visLine from:startCol |
2812 |
"redefined to always draw a full line - for openwin handling" |
|
21 | 2813 |
|
202 | 2814 |
self redrawVisibleLine:visLine |
2815 |
! |
|
2816 |
||
2817 |
redrawVisibleLine:visLine from:startCol to:endCol |
|
2818 |
"redefined to always draw a full line - for openwin handling" |
|
2819 |
||
2820 |
self redrawVisibleLine:visLine |
|
0 | 2821 |
! ! |
2822 |
||
202 | 2823 |
!MenuView methodsFor:'selections'! |
2824 |
||
2825 |
isValidSelection:aNumber |
|
2826 |
"return true, if aNumber is ok for a selection lineNo" |
|
2827 |
||
2828 |
|line| |
|
2829 |
||
2830 |
(super isValidSelection:aNumber) ifFalse:[^ false]. |
|
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1627
diff
changeset
|
2831 |
(enableFlags at:aNumber) ifFalse:[^ false]. |
202 | 2832 |
|
2833 |
line := self listAt:aNumber. |
|
2834 |
^ (self isGraphicItem:line) not |
|
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1627
diff
changeset
|
2835 |
|
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1627
diff
changeset
|
2836 |
"Modified: / 8.8.1998 / 03:31:14 / cg" |
202 | 2837 |
! ! |
191
5ccbde40bb6b
draw strings half a lineSpacing lower - highlight frames look better
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
2838 |
|
202 | 2839 |
!MenuView methodsFor:'showing'! |
2840 |
||
2841 |
realize |
|
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2842 |
self resizeIfChanged. |
202 | 2843 |
super realize |
426
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2844 |
|
bf35bf40ab11
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2845 |
"Modified: 28.2.1996 / 18:17:05 / cg" |
202 | 2846 |
! |
2847 |
||
2848 |
show |
|
3551
8cca2a43e849
use accessors for hiddenOnRealize and explicitExtents
Claus Gittinger <cg@exept.de>
parents:
3464
diff
changeset
|
2849 |
self hiddenOnRealize:false. |
509 | 2850 |
self showPassive. |
202 | 2851 |
self realize |
509 | 2852 |
|
2853 |
"Modified: 21.3.1996 / 17:21:46 / cg" |
|
1058
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
2854 |
! |
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
2855 |
|
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
2856 |
unmap |
1858 | 2857 |
"unmap the view - the view stays created (but invisible), and can be remapped again later." |
2858 |
||
1058
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
2859 |
self hideSubmenu. |
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
2860 |
super unmap. |
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
2861 |
|
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
2862 |
"Created: 25.2.1997 / 23:01:56 / cg" |
bf4c27091f6b
ignore motions if more are pending;
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
2863 |
"Modified: 25.2.1997 / 23:02:09 / cg" |
191
5ccbde40bb6b
draw strings half a lineSpacing lower - highlight frames look better
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
2864 |
! ! |
5ccbde40bb6b
draw strings half a lineSpacing lower - highlight frames look better
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
2865 |
|
110 | 2866 |
!MenuView methodsFor:'submenu notifications'! |
7 | 2867 |
|
70 | 2868 |
regainControl |
7 | 2869 |
"take over pointer control from a submenu" |
2870 |
||
70 | 2871 |
masterView notNil ifTrue:[ |
1860 | 2872 |
masterView regainControl. |
2873 |
subMenuShown := nil. |
|
70 | 2874 |
]. |
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
463
diff
changeset
|
2875 |
|
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
463
diff
changeset
|
2876 |
"Modified: 4.3.1996 / 23:17:15 / cg" |
7 | 2877 |
! |
2878 |
||
2879 |
showActive |
|
110 | 2880 |
"submenu is about to perform a menu-action - show wait cursor here as well" |
7 | 2881 |
|
2882 |
self cursor:(Cursor wait) |
|
2883 |
! |
|
2884 |
||
2885 |
showPassive |
|
110 | 2886 |
"submenu has finished its menu-action - show normal cursor again" |
7 | 2887 |
|
2888 |
self cursor:(Cursor hand) |
|
0 | 2889 |
! |
2890 |
||
202 | 2891 |
submenuTriggered |
2892 |
"submenu has performed some action - have to deselect here" |
|
77 | 2893 |
|
683 | 2894 |
self setSelection:nil. |
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
463
diff
changeset
|
2895 |
|
202 | 2896 |
"a bad kludge - 5 minutes before writing the alpha tapes ..." |
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
463
diff
changeset
|
2897 |
superView isPopUpView ifTrue:[ |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
2898 |
superView hide |
136 | 2899 |
]. |
202 | 2900 |
superMenu notNil ifTrue:[ |
1403
ddc59498d1c3
toggle & cursor behavior as in mswindows
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
2901 |
superMenu submenuTriggered |
202 | 2902 |
]. |
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
463
diff
changeset
|
2903 |
|
683 | 2904 |
"Modified: 25.5.1996 / 12:27:42 / cg" |
0 | 2905 |
! ! |
202 | 2906 |
|
878 | 2907 |
!MenuView class methodsFor:'documentation'! |
205 | 2908 |
|
2909 |
version |
|
3911
2e2c5429a2f9
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3903
diff
changeset
|
2910 |
^ '$Header: /cvs/stx/stx/libwidg/MenuView.st,v 1.157 2009-09-15 18:15:42 cg Exp $' |
205 | 2911 |
! ! |