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