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