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