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