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