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