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