MenuPanel.st
author Stefan Vogel <sv@exept.de>
Fri, 08 Aug 2003 10:11:09 +0200
changeset 2545 e838be7f2c83
parent 2505 56607624d05a
child 2550 1dc3745fc313
permissions -rw-r--r--
Tell application name in info message about no-existing aspects.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2005
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     1
"
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     2
 COPYRIGHT (c) 1997 by eXept Software AG
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
     3
	      All Rights Reserved
2005
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     4
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     5
 This software is furnished under a license and may be used
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     6
 only in accordance with the terms of that license and with the
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     9
 other person.  No title to or ownership of the software is
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    10
 hereby transferred.
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    11
"
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    12
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    13
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
    14
"{ Package: 'stx:libwidg2' }"
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
    15
2182
59a770bbb95a changed superclass to View (to inherit model)
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
    16
View subclass:#MenuPanel
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
    17
	instanceVariableNames:'adornment shadowView mapTime mustRearrange superMenu
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
    18
		shortKeyInset selection items groupSizes receiver enabled
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
    19
		lastActiveMenu enteredItem prevFocusView previousPointerGrab
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
    20
		previousKeyboardGrab relativeGrabOrigin hasImplicitGrap
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
    21
		scrollActivity rightArrowShadow rightArrow fgColor verticalLayout
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
    22
		showSeparatingLines showGroupDivider implicitGrabView
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
    23
		lastPointerView openDelayedMenuBlock preferredWidth application
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
    24
		originator centerItems hideOnRelease defaultHideOnRelease'
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
    25
	classVariableNames:'InitialSelectionQuerySignal Images LigthenedImages'
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
    26
	poolDictionaries:''
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
    27
	category:'Views-Menus'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    28
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    29
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    30
Object subclass:#Item
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
    31
	instanceVariableNames:'menuItem layout menuPanel subMenu displayLabel displayLabelExtent
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
    32
		disabledDisplayLabel enableChannel label activeHelpText
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
    33
		flyByHelpText isVisible indication choice accessCharacter'
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
    34
	classVariableNames:'HorizontalInset VerticalInset HorizontalButtonInset
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
    35
		VerticalButtonInset LabelRightOffset VerticalPopUpInset'
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
    36
	poolDictionaries:''
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
    37
	privateIn:MenuPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    38
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    39
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
    40
Object subclass:#ScrollActivity
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
    41
	instanceVariableNames:'semaLock activeMenu scrollTask direction icons'
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
    42
	classVariableNames:''
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
    43
	poolDictionaries:''
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
    44
	privateIn:MenuPanel
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
    45
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
    46
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    47
!MenuPanel class methodsFor:'documentation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    48
2005
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    49
copyright
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    50
"
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    51
 COPYRIGHT (c) 1997 by eXept Software AG
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
    52
	      All Rights Reserved
2005
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    53
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    54
 This software is furnished under a license and may be used
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    55
 only in accordance with the terms of that license and with the
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    56
 inclusion of the above copyright notice.   This software may not
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    57
 be provided or otherwise made available to, or used by, any
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    58
 other person.  No title to or ownership of the software is
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    59
 hereby transferred.
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    60
"
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    61
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    62
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    63
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    64
documentation
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    65
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    66
    a menu panel used for both pull-down-menus and pop-up-menus.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    67
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
    68
    this will eventually replace most of the MenuView and PopUpMenu stuff.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    69
    (and hopefully be ST-80 compatible ...)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    70
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    71
    To create a menu, there exists a MenuEditor which will generate
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    72
    a menu specification.
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    73
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    74
2061
faf64f2cd28e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2059
diff changeset
    75
    Notice:
faf64f2cd28e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2059
diff changeset
    76
        This is going to replace the obsolete MenuView.
faf64f2cd28e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2059
diff changeset
    77
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    78
    [author:]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    79
        Claus Atzkern
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    80
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    81
    [see also:]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    82
        Menu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    83
        MenuItem
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    84
        MenuEditor
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
    85
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
    86
    cg: this code is so ugly - needs a complete rewrite...
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
    87
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    88
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    89
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    90
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    91
examples
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    92
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    93
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    94
    start as PullDownMenu
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
    95
										[exBegin]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    96
    |top subView mview desc s1 s2 s3 img lbs labels|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    97
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    98
    top := StandardSystemView new.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    99
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   100
    mview := MenuPanel in:top.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   101
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   102
    labels := #( 'foo' 'bar' 'baz' 'test' 'claus' ).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   103
    mview level:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   104
    mview verticalLayout:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   105
    img := Image fromFile:'bitmaps/SBrowser.xbm'.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   106
    lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test' with:'ludwig'.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   107
    mview labels:lbs.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   108
    mview shortcutKeyAt:2 put:#Cut.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   109
    mview accessCharacterPositionAt:1 put:1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   110
    mview accessCharacterPositionAt:2 put:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   111
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   112
    mview enabledAt:5 put:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   113
    mview groupSizes:#( 2 2 ).
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   114
    s1 := MenuPanel labels:labels.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   115
    s1 accessCharacterPositionAt:1 put:1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   116
    s1 accessCharacterPositionAt:2 put:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   117
    s1 groupSizes:#( 2 2 ).
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   118
    s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ).
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   119
    s3 := MenuPanel labels:lbs.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   120
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   121
    s1 subMenuAt:2 put:s2.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   122
    s1 subMenuAt:3 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   123
    s2 subMenuAt:3 put:s3.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   124
    s3 subMenuAt:3 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   125
    s3 shortcutKeyAt:3 put:$q.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   126
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   127
    mview subMenuAt:1 put:s1.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   128
    mview subMenuAt:4 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   129
    (mview subMenuAt:4) shortcutKeyAt:3 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   130
    s1 shortcutKeyAt:1 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   131
    s1 shortcutKeyAt:3 put:#Paste.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   132
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   133
    mview subMenuAt:2 put:(MenuPanel labels:labels).
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   134
    top extent:(mview preferredExtent).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   135
    top open.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   136
										[exEnd]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   137
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   138
										[exBegin]
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   139
    |top menu view item|
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   140
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   141
    top  := StandardSystemView extent:240@100.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   142
    menu := MenuPanel in:top.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   143
    menu labels:#( 'foo' 'Application' 'Clock' ).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   144
    menu verticalLayout:false.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   145
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   146
    menu subMenuAt:1 put:(MenuPanel labels:#( 'bar' 'baz' )).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   147
    menu subMenuAt:2 put:(MenuPanel labels:#( 'foo' 'bar' 'baz' )).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   148
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   149
    view := ClockView new.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   150
    view preferredExtent:100@100.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   151
    item := menu itemAt:3.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   152
    item submenu:view.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   153
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   154
    view := SimpleView new.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   155
    view client:(CodingExamples_GUI::GUIDemoExtendedComboBox new).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   156
    view preferredExtent:(400@50).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   157
    item := menu itemAt:2.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   158
    item submenu:view.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   159
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   160
    menu origin:0@0 corner:1.0@30.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   161
    top open.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   162
										[exEnd]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   163
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   164
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   165
    start as PopUpMenu
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   166
										[exBegin]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   167
    |subView mview desc s1 s2 s3 img lbs labels|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   168
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   169
    mview := MenuPanel new.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   170
    labels := #( 'foo' 'bar' 'baz' ).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   171
    mview level:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   172
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   173
    img := Image fromFile:'bitmaps/SBrowser.xbm'.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   174
    lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test'.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   175
    mview labels:lbs.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   176
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   177
    s1 := MenuPanel labels:labels.
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   178
    s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ).
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   179
    s3 := MenuPanel labels:lbs.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   180
    s1 subMenuAt:2 put:s2.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   181
    s1 subMenuAt:3 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   182
    s2 subMenuAt:3 put:s3.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   183
    s3 subMenuAt:3 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   184
    s3 shortcutKeyAt:3 put:$q.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   185
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   186
    mview subMenuAt:1 put:s1.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   187
    mview subMenuAt:4 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   188
    (mview subMenuAt:4) shortcutKeyAt:3 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   189
    s1 shortcutKeyAt:1 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   190
    s1 shortcutKeyAt:3 put:#Paste.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   191
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   192
    mview subMenuAt:2 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   193
    mview startUp
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   194
										[exEnd]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   195
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   196
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   197
    start from menu spec
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   198
										[exBegin]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   199
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   200
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   201
    menu := MenuPanel menu:
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   202
	#(#Menu #( #(#MenuItem 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   203
		    #label: 'File' 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   204
		    #submenu:
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   205
		      #(#Menu #(#(#MenuItem #label: 'quit' #value:#quit )     
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   206
				 (#MenuItem 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   207
				    #label: 'edit' 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   208
				    #submenu:
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   209
				      #(#Menu #( #(#MenuItem #label: 'edit'  #value:#edit )     
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   210
						 #(#MenuItem #label: 'close' #value:#close)     
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   211
					       )
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   212
					       nil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   213
					       nil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   214
				       )     
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   215
				  )
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   216
				 #(#MenuItem #label: 'help' #value:#help )     
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   217
			       )
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   218
			       nil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   219
			       nil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   220
		       )     
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   221
		 ) 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   222
		#(#MenuItem #label: 'Inspect' #value:#inspectMenu ) 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   223
		#(#MenuItem #label: 'Bar' 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   224
			    #submenu:
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   225
			       #(#Menu #( #(#MenuItem #label: 'bar 1' #value:#bar1 )     
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   226
					  #(#MenuItem #label: 'bar 2' #value:#bar2 )     
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   227
					)
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   228
					nil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   229
					nil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   230
				)     
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   231
		 ) 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   232
	      ) 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   233
	      #( 2 )
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   234
	      nil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   235
	 ) decodeAsLiteralArray.  
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   236
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   237
    menu verticalLayout:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   238
    Transcript showCR:(menu startUp).
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   239
										[exEnd]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   240
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   241
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   242
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   243
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   244
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   245
!MenuPanel class methodsFor:'instance creation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   246
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   247
fromSpec:aSpec
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   248
    ^ self fromSpec:aSpec receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   249
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   250
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   251
fromSpec:aSpec receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   252
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   253
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   254
    aSpec notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   255
	menu := Menu new.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   256
	menu receiver:aReceiver.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   257
	menu fromLiteralArrayEncoding:aSpec.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   258
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   259
  ^ self menu:menu receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   260
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   261
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   262
labels:labels
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   263
    ^ self labels:labels nameKeys:nil receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   264
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   265
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   266
labels:labels nameKeys:nameKeys
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   267
    ^ self labels:labels nameKeys:nameKeys receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   268
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   269
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   270
labels:labels nameKeys:nameKeys receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   271
    |mview|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   272
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   273
    mview := self menu:nil receiver:aReceiver.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   274
    mview labels:labels.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   275
    mview nameKeys:nameKeys.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   276
  ^ mview
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   277
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   278
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   279
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   280
labels:labels receiver:aReceiver
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   281
    ^ self labels:labels nameKeys:nil receiver:aReceiver
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   282
!
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   283
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   284
menu:aMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   285
    ^ self menu:aMenu receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   286
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   287
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   288
menu:aMenu receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   289
    |mview|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   290
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   291
    mview := self new.
1955
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   292
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   293
    (aMenu notNil and:[aMenu receiver isNil]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   294
	"/ no receiver specified in the menu; thus set the receiver immediately
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   295
	mview receiver:aReceiver
1955
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   296
    ].
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   297
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   298
    mview menu:aMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   299
1955
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   300
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   301
"/ a menu itself may contain a receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   302
"/ thus we do not overwrite the receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   303
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   304
    aReceiver notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   305
	mview receiver:aReceiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   306
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   307
  ^ mview
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   308
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   309
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   310
!MenuPanel class methodsFor:'class initialization'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   311
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   312
initialize
657
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   313
    "
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   314
    self initialize
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   315
    "
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   316
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   317
    InitialSelectionQuerySignal isNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   318
        InitialSelectionQuerySignal := QuerySignal new.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   319
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   320
660
d1670dfe5445 Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents: 658
diff changeset
   321
    "Modified: / 15.1.1998 / 23:08:31 / stefan"
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   322
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   323
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   324
preSnapshot
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   325
    "remove all resources
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   326
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   327
    Images := nil.
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   328
    LigthenedImages := nil.
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   329
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   330
! !
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   331
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   332
!MenuPanel class methodsFor:'default icons'!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   333
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   334
delayedMenuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   335
    "This resource specification was automatically generated
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   336
     by the ImageEditor of ST/X."
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   337
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   338
    "Do not manually edit this!! If it is corrupted,
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   339
     the ImageEditor may not be able to read the specification."
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   340
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   341
    "
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   342
     self delayedMenuIndicator inspect
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   343
     ImageEditor openOnClass:self andSelector:#delayedMenuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   344
     Icon flushCachedIcons
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   345
    "
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   346
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   347
    <resource: #image>
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   348
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   349
    ^Icon
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   350
        constantNamed:#'MenuPanel class delayedMenuIndicator'
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   351
        ifAbsentPut:[(Depth1Image new) width: 7; height: 6; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@HCB') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 7; height: 6; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@J+V[C P') ; yourself); yourself]
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   352
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   353
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   354
iconIndicationDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   355
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   356
     by the ImageEditor of ST/X."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   357
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   358
    "Do not manually edit this!! If it is corrupted,
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   359
     the ImageEditor may not be able to read the specification."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   360
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   361
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   362
     self iconIndicationDisabledOff inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   363
     ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   364
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   365
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   366
    <resource: #image>
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   367
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   368
    ^Icon
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   369
	constantNamed:#'MenuPanel iconIndicationDisabledOff'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   370
	ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUPG???8A:***@^*** G***(A:***@^*** G***(A:***@^*** G***(A:***@Z*** @@@@@@b') ; colorMapFromArray:#[255 255 255 127 127 127 170 170 170 0 0 0]; mask:((Depth1Image new) width: 14; height: 14; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a') ; yourself); yourself]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   371
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   372
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   373
iconIndicationDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   374
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   375
     by the ImageEditor of ST/X."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   376
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   377
    "Do not manually edit this!! If it is corrupted,
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   378
     the ImageEditor may not be able to read the specification."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   379
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   380
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   381
     self iconIndicationDisabledOn inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   382
     ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   383
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   384
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   385
    <resource: #image>
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   386
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   387
    ^Icon
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   388
	constantNamed:#'MenuPanel iconIndicationDisabledOn'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   389
	ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'****$H@@@MBO???P#???4H??<=BO?<OP#O<C4H0<C=BL@C?P#0C?4H?C?=BO???P/???4EUUUU@b') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; mask:((Depth1Image new) width: 14; height: 14; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a') ; yourself); yourself]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   390
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   391
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   392
iconIndicationOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   393
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   394
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   395
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   396
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   397
     the ImageEditor may not be able to read the specification."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   398
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   399
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   400
     self iconIndicationOff inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   401
     ImageEditor openOnClass:self andSelector:#iconIndicationOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   402
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   403
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   404
    <resource: #image>
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   405
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   406
    ^Icon
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   407
	constantNamed:#'MenuPanel iconIndicationOff'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   408
	ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUPG???8A0@@B@\@@@ G@@@HA0@@B@\@@@ G@@@HA0@@B@\@@@ G@@@HA0@@B@Z*** @@@@@@b') ; colorMapFromArray:#[255 255 255 127 127 127 170 170 170 0 0 0]; mask:((Depth1Image new) width: 14; height: 14; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a') ; yourself); yourself]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   409
!
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   410
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   411
iconIndicationOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   412
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   413
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   414
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   415
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   416
     the ImageEditor may not be able to read the specification."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   417
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   418
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   419
     self iconIndicationOn inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   420
     ImageEditor openOnClass:self andSelector:#iconIndicationOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   421
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   422
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   423
    <resource: #image>
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   424
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   425
    ^Icon
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   426
	constantNamed:#'MenuPanel iconIndicationOn'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   427
	ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'****$H@@@MBEUUWP!!UUU4HUUT]BEUTGP!!ETA4HPTA]BD@AWP!!PAU4HUAU]BEUUWP/???4EUUUU@b') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; mask:((Depth1Image new) width: 14; height: 14; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a') ; yourself); yourself]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   428
!
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   429
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   430
iconRadioGroupDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   431
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   432
     by the ImageEditor of ST/X."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   433
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   434
    "Do not manually edit this!! If it is corrupted,
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   435
     the ImageEditor may not be able to read the specification."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   436
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   437
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   438
     self iconRadioGroupDisabledOff inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   439
     ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   440
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   441
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   442
    <resource: #image>
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   443
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   444
    ^Icon
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   445
	constantNamed:#'MenuPanel iconRadioGroupDisabledOff'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   446
	ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@AUP@@E@AP@DJ*Y@DZ**(AJ**+AJ***LR***#D***(1J***LR***#AZ**#@Z**(0A** 0@C@C0@@O?@@') ; colorMapFromArray:#[0 0 0 85 85 85 170 170 170 255 255 255]; mask:((Depth1Image new) width: 15; height: 15; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A<@_<C?8_?1??O?:??+?>/?:??)?=G?4O< HL@_@') ; yourself); yourself]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   447
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   448
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   449
iconRadioGroupDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   450
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   451
     by the ImageEditor of ST/X."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   452
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   453
    "Do not manually edit this!! If it is corrupted,
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   454
     the ImageEditor may not be able to read the specification."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   455
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   456
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   457
     self iconRadioGroupDisabledOn inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   458
     ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOn
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
   459
     Icon flushCachedIcons
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   460
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   461
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   462
    <resource: #image>
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   463
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   464
    ^Icon
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
   465
        constantNamed:#'MenuPanel class iconRadioGroupDisabledOn'
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
   466
        ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@AUP@@E@AP@DJ*Y@DYUZ(AIUU+AIUUVLRUUU#D%UUX1IUUVLRUUU#AYUU#@Z%U(0A** 0@C@C0@@O?@@') ; colorMapFromArray:#[0 0 0 85 85 85 170 170 170 255 255 255]; mask:((Depth1Image new) width: 15; height: 15; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A<@_<C?8_?1??O?:??+?>/?:??)?=G?4O< HL@_@') ; yourself); yourself]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   467
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   468
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   469
iconRadioGroupOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   470
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   471
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   472
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   473
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   474
     the ImageEditor may not be able to read the specification."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   475
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   476
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   477
     self iconRadioGroupOff inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   478
     ImageEditor openOnClass:self andSelector:#iconRadioGroupOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   479
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   480
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   481
    <resource: #image>
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   482
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   483
    ^Icon
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   484
	constantNamed:#'MenuPanel iconRadioGroupOff'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   485
	ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@AUP@@E@AP@DO?Y@D_?>(AO??;AO???LS???3D???<1O???LS???3A_??3@Z??<0A+?00@C@C0@@O?@@') ; colorMapFromArray:#[0 0 0 85 85 85 170 170 170 255 255 255]; mask:((Depth1Image new) width: 15; height: 15; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A<@_<C?8_?1??O?:??+?>/?:??)?=G?4O< HL@_@') ; yourself); yourself]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   486
!
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   487
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   488
iconRadioGroupOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   489
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   490
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   491
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   492
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   493
     the ImageEditor may not be able to read the specification."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   494
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   495
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   496
     self iconRadioGroupOn inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   497
     ImageEditor openOnClass:self andSelector:#iconRadioGroupOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   498
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   499
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   500
    <resource: #image>
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   501
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   502
    ^Icon
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   503
	constantNamed:#'MenuPanel iconRadioGroupOn'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   504
	ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@AUP@@E@AP@DO?Y@D]@^(AL@@;AM@@GLS@@@3D0@@L1L@@CLSP@A3A\@@3@Z4A<0A+?00@C@C0@@O?@@') ; colorMapFromArray:#[0 0 0 85 85 85 170 170 170 255 255 255]; mask:((Depth1Image new) width: 15; height: 15; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A<@_<C?8_?1??O?:??+?>/?:??)?=G?4O< HL@_@') ; yourself); yourself]
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   505
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   506
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   507
menuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   508
    "This resource specification was automatically generated
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   509
     by the ImageEditor of ST/X."
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   510
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   511
    "Do not manually edit this!! If it is corrupted,
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   512
     the ImageEditor may not be able to read the specification."
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   513
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   514
    "
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   515
     self menuIndicator inspect
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   516
     ImageEditor openOnClass:self andSelector:#menuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   517
     Icon flushCachedIcons
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   518
    "
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   519
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   520
    <resource: #image>
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   521
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   522
    ^Icon
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   523
        constantNamed:#'MenuPanel::Item class menuIndicator'
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   524
        ifAbsentPut:[(Depth1Image new) width: 7; height: 4; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@B@0 @a') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 7; height: 4; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?''08D@@a') ; yourself); yourself]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   525
! !
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   526
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   527
!MenuPanel class methodsFor:'defaults'!
450
ac72eb2ed895 initialize fix
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   528
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   529
defaultBackgroundColor
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   530
    ^ StyleSheet at:#'pullDownMenu.backgroundColor' default:DefaultViewBackgroundColor.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   531
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   532
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   533
defaultLevel
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   534
    ^ StyleSheet at:#'pullDownMenu.level' default:1
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   535
"
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   536
self defaultLevel
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   537
"
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   538
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   539
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   540
delayedMenuIndicatorOffset
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   541
    "returns an additional offset between the label and the
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   542
     delayedMenu indication (i.e. the down-arrow icon)
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   543
    "
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   544
    ^ 1 "2"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   545
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   546
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   547
menuIndicatorOffset
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   548
    "returns an additional offset between the label and the
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   549
     delayedMenu indication (i.e. the down-arrow icon)
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   550
    "
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   551
    ^ 1 "2"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   552
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   553
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   554
mnemonicIdentifier
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   555
    "returns the identifier each mnemonic starts with;
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   556
     ex:
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   557
	&File   mnemonic := Cmdf
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   558
	F&ile   mnemonic := Cmdi
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   559
	.....
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   560
    "
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   561
    ^ 'Cmd'
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   562
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   563
450
ac72eb2ed895 initialize fix
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   564
updateStyleCache
657
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   565
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   566
    <resource: #style (
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   567
        #'popup.borderWidth' #'popup.level' 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   568
        #'selection.disabledForegroundColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   569
        #'pullDownMenu.foregroundColor' #'pullDownMenu.backgroundColor' #'pullDownMenu.level'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   570
        #'menu.itemHorizontalSpace' #'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   571
        #'menu.buttonItemVerticalSpace'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   572
        #'menu.buttonActiveLevel' #'menu.buttonPassiveLevel' #'menu.buttonEnteredLevel'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   573
        #'menu.hilightLevel' #'menu.enteredLevel'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   574
        #'menu.groupDividerSize' #'menu.itemMargin'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   575
        #'menu.disabledEtchedForegroundColor' #'menu.hilightForegroundColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   576
        #'menu.enteredBackgroundColor' #'menu.enteredForegroundColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   577
        #'menu.disabledForegroundColor' #'menu.buttonEnteredBackgroundColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   578
        #'menu.selectionFollowsMouse'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   579
        #'button.disabledEtchedForegroundColor' #'button.disabledForegroundColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   580
        #'button.activeBackgroundColor' #'button.backgroundColor' #'button.lightColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   581
        #'button.enteredBackgroundColor' #'button.halfLightColor' #'button.halfShadowColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   582
        #'button.activeLevel' #'button.passiveLevel' #'button.edgeStyle'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   583
    )>
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   584
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   585
    |styleSheet style var foregroundColor backgroundColor buttonPassiveBackgroundColor
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   586
    buttonActiveLevel buttonPassiveLevel buttonEnteredLevel|
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   587
"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   588
self updateStyleCache
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   589
"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   590
    MenuView            updateStyleCache.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   591
    SelectionInListView updateStyleCache.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   592
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   593
    styleSheet  := StyleSheet.
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   594
    style       := styleSheet name.
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   595
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   596
    DefaultFont     := styleSheet at:#'menu.font'.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   597
    foregroundColor := styleSheet colorAt:#'pullDownMenu.foregroundColor' default:Color black.
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   598
    backgroundColor := self defaultBackgroundColor.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   599
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   600
    var := styleSheet at:#'menu.buttonItemHorizontalSpace'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   601
    var isNil ifTrue:[ var := styleSheet at:#'menu.buttonItemSpace' default:0 ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   602
    styleSheet at:#'menuPanel.buttonInsetX' put:(var abs).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   603
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   604
    var := styleSheet at:#'menu.buttonItemVerticalSpace'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   605
    var isNil ifTrue:[ var := styleSheet at:#'menu.buttonItemSpace' default:0 ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   606
    styleSheet at:#'menuPanel.buttonInsetY' put:(var abs).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   607
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   608
    var := styleSheet at:#'menu.itemHorizontalSpace'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   609
    var isNil ifTrue:[ var := styleSheet at:#'menu.itemSpace' default:0 ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   610
    styleSheet at:#'menuPanel.itemSpace' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   611
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   612
    var := styleSheet colorAt:#'menu.hilightBackgroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   613
    var isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   614
        style == #motif ifTrue:[ var := backgroundColor ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   615
                       ifFalse:[ var := styleSheet is3D ifFalse:[foregroundColor] ifTrue:[backgroundColor] ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   616
    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   617
    styleSheet at:#'menuPanel.activeBackgroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   618
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   619
    var := styleSheet colorAt:#'menu.disabledEtchedForegroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   620
    var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledEtchedForegroundColor' ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   621
    styleSheet at:#'menuPanel.disabledEtchedFgColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   622
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   623
    var := styleSheet colorAt:#'menu.disabledForegroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   624
    var isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   625
        var := styleSheet colorAt:#'selection.disabledForegroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   626
        var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledForegroundColor' default:Color darkGray ]
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   627
    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   628
    styleSheet at:#'menuPanel.disabledForegroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   629
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   630
    var := styleSheet colorAt:#'menu.hilightForegroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   631
    var isNil ifTrue:[ var := styleSheet is3D ifTrue:[foregroundColor] ifFalse:[backgroundColor] ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   632
    styleSheet at:#'menuPanel.activeForegroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   633
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   634
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   635
    buttonActiveLevel := styleSheet at:#'menu.buttonActiveLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]).
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   636
    buttonActiveLevel isNil ifTrue:[ buttonActiveLevel := styleSheet at:#'button.activeLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]) ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   637
    styleSheet at:#'menuPanel.buttonActiveLevel' put:buttonActiveLevel.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   638
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   639
    buttonPassiveLevel := styleSheet at:#'menu.buttonPassiveLevel'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   640
    buttonPassiveLevel isNil ifTrue:[ buttonPassiveLevel :=  styleSheet at:#'button.passiveLevel' default:(styleSheet is3D ifTrue:[2] ifFalse:[0])].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   641
    styleSheet at:#'menuPanel.buttonPassiveLevel' put:buttonPassiveLevel.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   642
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   643
    buttonEnteredLevel := styleSheet at:#'menu.buttonEnteredLevel' default:buttonPassiveLevel.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   644
    styleSheet at:#'menuPanel.buttonEnteredLevel' put:buttonEnteredLevel.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   645
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   646
    var := (buttonActiveLevel abs max:(buttonPassiveLevel abs)) max:(buttonEnteredLevel abs).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   647
    styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   648
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   649
    buttonPassiveBackgroundColor := styleSheet at:#'button.backgroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   650
    buttonPassiveBackgroundColor isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   651
        buttonPassiveBackgroundColor := (styleSheet at:'viewBackground') ? backgroundColor
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   652
    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   653
    styleSheet at:#'menuPanel.buttonPassiveBackgroundColor' put:buttonPassiveBackgroundColor.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   654
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   655
    var := styleSheet at:#'button.lightColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   656
    var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) lightened ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   657
    styleSheet at:#'menuPanel.buttonLightColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   658
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   659
    var :=  styleSheet at:#'button.shadowColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   660
    var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) darkened ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   661
    styleSheet at:#'menuPanel.buttonShadowColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   662
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   663
    var := styleSheet colorAt:#'menu.buttonEnteredBackgroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   664
    var isNil ifTrue:[ var := styleSheet colorAt:#'button.enteredBackgroundColor' default:buttonPassiveBackgroundColor ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   665
    styleSheet at:#'menuPanel.buttonEnteredBackgroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   666
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   667
    Item updateStyleCache.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   668
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   669
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   670
!MenuPanel class methodsFor:'image registration'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   671
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   672
image:anImage onDevice:aDevice
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   673
"
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   674
Images := nil
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   675
"
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   676
    |deviceImages|
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   677
1156
6fa33dc93509 fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   678
    anImage device == aDevice ifTrue:[
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   679
        ^ anImage
1853
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   680
    ].
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   681
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   682
    Images isNil ifTrue:[ Images := WeakIdentityDictionary new ].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   683
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   684
    (deviceImages := Images at:aDevice ifAbsent:nil) isNil ifTrue:[
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   685
        Images at:aDevice put:(deviceImages := Dictionary new)
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   686
    ].
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   687
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   688
    ^ deviceImages at:anImage ifAbsentPut:[ |image|
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   689
        image := anImage copy onDevice:aDevice.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   690
        image clearMaskedPixels.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   691
        deviceImages at:anImage put:image.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   692
        image
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   693
    ].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   694
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   695
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   696
lightenedImage:anImage onDevice:aDevice
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   697
"
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   698
LigthenedImages := nil
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   699
"
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   700
    |deviceImages image colorMap|
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   701
1853
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   702
    LigthenedImages isNil ifTrue:[ LigthenedImages := WeakIdentityDictionary new ].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   703
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   704
    (deviceImages := LigthenedImages at:aDevice ifAbsent:nil) isNil ifTrue:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   705
        LigthenedImages at:aDevice put:(deviceImages := Dictionary new)
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   706
    ].
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   707
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   708
    (image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   709
        ^ image
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   710
    ].
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   711
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   712
    colorMap := anImage perform:#colorMap ifNotUnderstood:nil.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   713
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   714
    colorMap notNil ifTrue:[
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   715
        image := anImage copy lightened onDevice:aDevice.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   716
        image clearMaskedPixels.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   717
    ] ifFalse:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   718
        image := self image:anImage onDevice:aDevice
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   719
    ].
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   720
    deviceImages at:anImage put:image.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   721
    ^ image
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   722
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   723
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   724
!MenuPanel class methodsFor:'private'!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   725
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   726
subMenu:aSubMenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   727
    "create a submenu; can be redifined in derived classes
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   728
    "
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   729
  ^ (self new) menu:aSubMenu.
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   730
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   731
    "Modified: / 8.8.1998 / 02:13:11 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   732
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   733
1808
e8628b502a49 methodCategory change
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   734
!MenuPanel methodsFor:'accepting'!
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   735
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   736
accept
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   737
    "accept current selected item
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   738
    "
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   739
    ^ self acceptItem:(self selection) inMenu:self
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   740
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   741
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
   742
accept:anItem 
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
   743
    "this is the topMenu: accept item "
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
   744
2050
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
   745
    |value item tgState itemIdx recv panel masterGroup winGrp acceptAction|
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
   746
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   747
    self superMenu notNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   748
        ^ self topMenu accept:anItem
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   749
    ].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
   750
    self openDelayed:nil.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   751
    self scrollActivity stop.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   752
    self selection:nil.
420
ca
parents: 417
diff changeset
   753
ca
parents: 417
diff changeset
   754
    (anItem notNil and:[anItem canAccept]) ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   755
        tgState := anItem toggleIndication.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   756
        panel   := anItem menuPanel.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   757
        itemIdx := panel findFirst:[:el| el == anItem ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   758
        item    := anItem.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   759
        recv    := panel receiver.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   760
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   761
    self doUngrab:true.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   762
510
8f77b9382066 bug fix with redraw
ca
parents: 505
diff changeset
   763
    self isPopUpView ifFalse:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   764
        self do:[:el| el updateIndicators].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   765
        self windowGroup processExposeEvents.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   766
    ] ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   767
        self unmap.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   768
        (winGrp := self windowGroup) notNil ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   769
            "/ give expose event a chance to arrive
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   770
            [shown and:[realized]] whileTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   771
                winGrp processExposeEventsFor:self
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   772
            ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   773
            masterGroup := winGrp previousGroup.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   774
        ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   775
        "/ cg: disabled-not needed - try PopUpList with destroy...
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   776
        "/ self destroy.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   777
        masterGroup notNil ifTrue:[masterGroup processExposeEvents].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   778
    ].
1710
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   779
2050
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
   780
    acceptAction := [ value := self accept:item index:itemIdx toggle:tgState receiver:recv ].
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
   781
1710
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   782
    (item notNil 
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   783
    and:[item showBusyCursorWhilePerforming
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   784
    and:[(winGrp := (masterGroup ? (self windowGroup))) notNil]])
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   785
    ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   786
        winGrp withWaitCursorDo:acceptAction
2132
fd5b29a20fe1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
   787
    ] ifFalse:[acceptAction value].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   788
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   789
    self isPopUpView ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   790
        self menuAdornmentAt:#item put:item.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   791
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   792
    ^ item.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   793
2050
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
   794
    "Modified: / 15.11.2001 / 17:05:40 / cg"
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   795
!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   796
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   797
accept:anItem index:anIndex toggle:aState receiver:aReceiver
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   798
    "accept an item
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   799
    "
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   800
    |value argument numArgs isValueModel rec args arg2 
1697
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
   801
     app master fallBack|
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   802
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   803
    anItem isNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   804
        self menuAdornmentAt:#hasPerformed put:true.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   805
      ^ nil
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   806
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   807
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   808
    isValueModel := aReceiver isValueModel.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   809
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   810
    self menuAdornmentAt:#hasPerformed put:isValueModel.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   811
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   812
    (value := anItem value) isNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   813
        ^ anIndex
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   814
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   815
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   816
    (argument := anItem argument) isNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   817
        argument := aState ? anItem
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   818
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   819
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   820
    value isSymbol ifFalse:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   821
        "/ a valueHolder or block
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   822
        (value respondsTo:#valueWithArguments:) ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   823
             ^ value
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   824
        ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   825
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   826
        numArgs := value perform:#numArgs ifNotUnderstood:0.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   827
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   828
        numArgs == 0 ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   829
            args := nil
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   830
        ] ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   831
            numArgs == 1 ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   832
                args := Array with:argument
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   833
            ] ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   834
                args := Array with:argument with:self
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   835
            ]
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   836
        ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   837
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   838
        value valueWithArguments:args.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   839
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   840
        self menuAdornmentAt:#hasPerformed put:true.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   841
        ^ anIndex
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   842
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   843
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   844
    anItem sendToOriginator ifTrue:[
2473
6ace3a7234b0 care for nil originator
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   845
        rec := self originator.
6ace3a7234b0 care for nil originator
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   846
        rec isNil ifTrue:[
6ace3a7234b0 care for nil originator
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   847
            self error:'no originating widget (no target for message)'.
6ace3a7234b0 care for nil originator
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   848
        ].
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   849
    ] ifFalse:[
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   850
        rec := aReceiver
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   851
    ].
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   852
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   853
    rec isNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   854
        ^ value
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   855
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   856
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   857
    isValueModel ifTrue:[
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   858
        rec value:value
465
67a0f3dd503a in case of performing a selector '0' is returned
ca
parents: 464
diff changeset
   859
    ] ifFalse:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   860
        arg2 := self.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   861
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   862
        "/ support for ST80 style applications
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   863
        "/ (expecting the message to go to the application
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   864
        "/  if not understood by the view)
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   865
        "/ These expect the controller to be passed as argument.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   866
        "/ sigh.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   867
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   868
        (rec isView
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   869
        and:[(rec respondsTo:value) not
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   870
        and:[(app := rec application) ~~ rec
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   871
        and:[app notNil]]]) ifTrue:[
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   872
            arg2 := rec controller.       "/ the Views controller
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   873
            rec := app.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   874
        ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   875
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   876
        (numArgs := value numArgs) == 0 ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   877
            args := nil
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   878
        ] ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   879
            numArgs == 1 ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   880
                args := Array with:argument
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   881
            ] ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   882
                args := Array with:argument with:arg2
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   883
            ]
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   884
        ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   885
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   886
        fallBack := 
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   887
            [
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   888
                "/ mhmh - the receiver did not respond to that message;
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   889
                "/ if there is a master-application, try that one
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   890
                "/ (recursive)
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   891
                master := rec perform:#masterApplication ifNotUnderstood:nil.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   892
                master notNil ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   893
                    rec := master.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   894
                    rec perform:value withArguments:args ifNotUnderstood:fallBack
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   895
                ] ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   896
                    self 
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   897
                        error:'unimplemented (or error in) menu message: ' , value
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   898
                        mayProceed:true
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   899
                ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   900
            ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   901
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   902
        rec perform:value withArguments:args ifNotUnderstood:fallBack.
420
ca
parents: 417
diff changeset
   903
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   904
    self menuAdornmentAt:#hasPerformed put:true.
1270
0ae582fd7294 send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents: 1267
diff changeset
   905
    ^ value
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   906
1719
ba7ebb56e6fd recursively try masterApps when performing
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
   907
    "Modified: / 19.2.2000 / 11:08:22 / cg"
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   908
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   909
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   910
acceptItem:anItem inMenu:aMenu
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
   911
    |tgState topMenu|
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
   912
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
   913
    topMenu := self topMenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
   914
    topMenu openDelayed:nil.
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   915
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
   916
    (anItem isNil or:[anItem hideMenuOnActivated]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   917
	topMenu accept:anItem
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   918
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   919
	anItem canAccept ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   920
	    tgState := anItem toggleIndication.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   921
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   922
	    self accept:anItem
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   923
		  index:(aMenu selectionIndex)
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   924
		 toggle:tgState 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   925
	       receiver:(aMenu receiver).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   926
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   927
	    aMenu do:[:el| el updateIndicators].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   928
	]
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   929
    ]
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   930
!
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   931
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   932
lastItemAccepted
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   933
    "returns last item selected or nil
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   934
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   935
  ^ self topMenu menuAdornmentAt:#item
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   936
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   937
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   938
lastValueAccepted
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   939
    "returns last value accepted or nil
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   940
    "
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   941
    ^ self lastItemAccepted value
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   942
! !
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   943
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   944
!MenuPanel methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   945
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   946
accessCharacterPositionAt:stringOrNumber
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   947
    "get the access character position for a textLabel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   948
    "
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
   949
    ^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   950
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   951
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   952
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   953
    "get the access character position for a textLabel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   954
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   955
    self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   956
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   957
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   958
accessCharacterPositions
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   959
    "returns a collection of accessCharacterPosition's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   960
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   961
    ^ self collect:[:anItem| anItem accessCharacterPosition ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   962
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   963
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   964
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   965
accessCharacterPositions:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   966
    "define accessCharacterPosition's for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   967
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   968
    self onEachPerform:#accessCharacterPosition: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   969
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   970
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   971
args
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   972
    "returns a collection of argument's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   973
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   974
    ^ self collect:[:anItem| anItem argument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   975
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   976
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   977
args:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   978
    "define arguments for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   979
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   980
    self onEachPerform:#argument: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   981
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   982
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   983
argsAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   984
    "gets the argument of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   985
    "
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
   986
    ^ self itemAt:stringOrNumber do:[:el| el argument ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   987
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   988
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   989
argsAt:stringOrNumber put:anArgument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   990
    "sets the argument of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   991
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   992
    self itemAt:stringOrNumber do:[:el| el argument:anArgument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   993
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   994
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   995
enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   996
    "return the item over which the mouse pointer is located;
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   997
     nil if the mouse is not over any item"
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   998
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   999
    ^ enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1000
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1001
    "Created: / 20.8.1998 / 13:12:34 / cg"
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1002
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1003
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1004
groupSizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1005
    "gets collection of group sizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1006
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1007
  ^ groupSizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1008
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1009
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1010
groupSizes:aGroupSizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1011
    "sets collection of group sizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1012
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1013
    aGroupSizes = groupSizes ifFalse:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1014
	groupSizes := aGroupSizes copy.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1015
	self mustRearrange.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1016
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1017
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1018
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1019
labelAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1020
    "gets the label of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1021
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1022
  ^ self itemAt:stringOrNumber do:[:el| el label ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1023
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1024
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1025
labelAt:stringOrNumber put:aLabel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1026
    "sets the label of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1027
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1028
    self itemAt:stringOrNumber do:[:el| el label:aLabel ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1029
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1030
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1031
labels
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1032
    "returns a collection of labels's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1033
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1034
    ^ self collect:[:anItem| anItem label ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1035
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1036
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1037
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1038
labels:labels
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1039
    "define labels for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1040
    "
2118
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  1041
    |size|
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  1042
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1043
    self disabledRedrawDo:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1044
	self removeAll.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1045
	size := labels size.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1046
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1047
	size > 0 ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1048
	    items := OrderedCollection new:size.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1049
	    labels do:[:aLabel| items add:(Item in:self label:aLabel) ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1050
	]
2118
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  1051
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1052
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1053
1999
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1054
menuPerformer:anObject 
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1055
    "set the menu-receiver. Thats the one who gets the messages ( both from myself and
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1056
     from all submenus no specific receiver is defined ).
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1057
    "
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1058
    ^ self receiver:anObject
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1059
!
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1060
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1061
nameKeyAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1062
    "gets the nameKey of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1063
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1064
  ^ self itemAt:stringOrNumber do:[:el| el nameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1065
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1066
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1067
nameKeyAt:stringOrNumber put:aNameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1068
    "sets the nameKey of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1069
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1070
    self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1071
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1072
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1073
nameKeys
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1074
    "returns a collection of nameKeys's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1075
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1076
    ^ self collect:[:anItem| anItem nameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1077
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1078
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1079
nameKeys:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1080
    "define nameKeys for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1081
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1082
    self onEachPerform:#nameKey: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1083
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1084
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1085
numberOfItems
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1086
    "gets number of items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1087
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1088
    ^ items size
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1089
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1090
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1091
originator
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1092
    originator notNil ifTrue:[^ originator].
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1093
    superMenu notNil ifTrue:[
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1094
        ^ superMenu originator
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1095
    ].
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1096
    ^ nil
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1097
!
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1098
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1099
receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1100
    "get the menu-receiver. Thats the one who gets the messages ( both from myself and
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1101
     from all submenus no specific receiver is defined ).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1102
    "
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1103
    (receiver isNil and:[superMenu notNil]) ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1104
	^ superMenu receiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1105
    ].
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1106
  ^ receiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1107
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1108
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1109
receiver:anObject 
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1110
    "set the menu-receiver. Thats the one who gets the messages ( both from myself and
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1111
     from all submenus no specific receiver is defined ).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1112
    "
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1113
    receiver := anObject
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1114
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1115
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1116
shortcutKeyAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1117
    "gets the shortCutKey of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1118
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1119
  ^ self itemAt:stringOrNumber do:[:el| el shortcutKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1120
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1121
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1122
shortcutKeyAt:stringOrNumber put:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1123
    "sets the shortCutKey of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1124
    "
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1125
    self itemAt:stringOrNumber do:[:el| el shortcutKey:aKey ]
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1126
!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1127
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1128
shortcutKeys
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1129
    "returns a collection of shortcutKey's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1130
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1131
    ^ self collect:[:anItem| anItem shortcutKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1132
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1133
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1134
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1135
shortcutKeys:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1136
    "define shortcutKey's for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1137
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1138
    self onEachPerform:#shortcutKey: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1139
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1140
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1141
valueAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1142
    "gets value of an item; a block, valueHolder, ...
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1143
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1144
  ^ self itemAt:stringOrNumber do:[:el| el value ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1145
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1146
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1147
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1148
valueAt:stringOrNumber put:someThing
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1149
    "sets value of an item; a block, valueHolder, ...
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1150
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1151
    self itemAt:stringOrNumber do:[:el| el value:someThing ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1152
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1153
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1154
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1155
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1156
values:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1157
    "define values for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1158
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1159
    self onEachPerform:#value: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1160
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1161
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1162
!MenuPanel methodsFor:'accessing-behavior'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1163
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1164
disableAll
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1165
    "disable all items; not the menu in case of enabled
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1166
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1167
    self do:[:anItem| anItem enabled:false]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1168
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1169
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1170
disableAll:collectionOfIndicesOrNames
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1171
    "disable an collection of items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1172
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1173
    collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1174
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1175
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1176
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1177
enableAll
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1178
    "enable all items; not the menu in case of disabled
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1179
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1180
    self do:[:anItem| anItem enabled:true]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1181
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1182
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1183
enableAll:collectionOfIndicesOrNames
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1184
    "enable an collection of items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1185
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1186
    collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1187
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1188
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1189
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1190
enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1191
    "returns enabled state
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1192
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1193
    ^ enabled
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1194
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1195
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1196
enabled:aState
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1197
    "change enabled state of menu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1198
    "
545
d01d14358b07 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 524
diff changeset
  1199
    |state|
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1200
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1201
    state := aState ? true.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1202
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  1203
    enabled ~~ state ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1204
	enabled := state.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1205
	self invalidate.
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1206
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1207
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1208
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1209
enabledAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1210
    "gets the enabled state of an item or false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1211
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1212
  ^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1213
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1214
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1215
enabledAt:stringOrNumber put:aState
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1216
    "sets the enabled state of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1217
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1218
    self itemAt:stringOrNumber do:[:el| el enabled:aState ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1219
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1220
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1221
isEnabled:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1222
    "gets the enabled state of an item or false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1223
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1224
    ^ self enabledAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1225
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1226
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1227
!MenuPanel methodsFor:'accessing-channels'!
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1228
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1229
enableChannel:aValueHolder
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1230
    "set my enableChannel
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1231
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1232
    enableChannel notNil ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1233
	enableChannel removeDependent:self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1234
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1235
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1236
    (enableChannel := aValueHolder) notNil ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1237
	enableChannel addDependent:self.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1238
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1239
    self enabled:(enableChannel value).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1240
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1241
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1242
menuHolder:aValueHolder
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1243
    "set my menuHolder
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1244
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1245
    menuHolder notNil ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1246
	menuHolder removeDependent:self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1247
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1248
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1249
    (menuHolder := aValueHolder) notNil ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1250
	menuHolder addDependent:self.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1251
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1252
    self menu:(menuHolder value)
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1253
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1254
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1255
!MenuPanel methodsFor:'accessing-color & font'!
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1256
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1257
activeBackgroundColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1258
    "get the background drawing color used to highlight selection
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1259
    "
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1260
    ^ styleSheet colorAt:#'menuPanel.activeBackgroundColor'
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1261
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1262
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1263
activeForegroundColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1264
    "get the foreground color used to highlight selections
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1265
    "
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1266
    ^ styleSheet colorAt:#'menuPanel.activeForegroundColor'
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1267
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1268
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1269
backgroundColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1270
    "return the background color
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1271
    "
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  1272
    ^ super viewBackground
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1273
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1274
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1275
backgroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1276
    "set the background drawing color. You should not use this method;
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1277
     instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1278
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1279
    super viewBackground ~~ aColor ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1280
	super viewBackground:aColor.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1281
	shown ifTrue:[
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1282
	    self invalidate "/ RepairNow:true
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1283
	]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1284
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1285
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1286
    "Modified: / 6.6.1998 / 19:50:06 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1287
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1288
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1289
buttonActiveBackgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1290
    "get the background drawing color used to highlight button selection
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1291
    "
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1292
    ^ styleSheet colorAt:#'button.activeBackgroundColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1293
                 default:(self viewBackground)
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1294
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1295
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1296
buttonEdgeStyle
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1297
    "get the button edge style
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1298
    "
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1299
    ^ styleSheet at:#'button.edgeStyle'
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1300
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1301
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1302
buttonEnteredBackgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1303
    "get the background drawing color used to highlight entered button items
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1304
    "
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1305
    ^ styleSheet colorAt:#'menuPanel.buttonEnteredBackgroundColor'
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1306
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1307
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1308
buttonEnteredLevel
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1309
    "get the 3D-level used to highlight entered button items
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1310
    "
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1311
    ^ styleSheet at:#'menuPanel.buttonEnteredLevel'
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1312
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1313
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1314
buttonHalfLightColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1315
    "get the background drawing color used to half light button frame
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1316
    "
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1317
    ^ styleSheet colorAt:#'button.halfLightColor'
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1318
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1319
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1320
buttonHalfShadowColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1321
    "get the background drawing color used to half shadow button frame
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1322
    "
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1323
    ^ styleSheet colorAt:#'button.halfShadowColor'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1324
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1325
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1326
buttonLightColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1327
    "get the background drawing color used to light button frame
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1328
    "
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1329
    ^ styleSheet colorAt:#'menuPanel.buttonLightColor'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1330
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1331
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1332
buttonPassiveBackgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1333
    "get the background drawing color used for button
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1334
    "
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1335
    ^ styleSheet colorAt:#'menuPanel.buttonPassiveBackgroundColor'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1336
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1337
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1338
buttonShadowColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1339
    "get the background drawing color used to shadow button frame
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1340
    "
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1341
    ^ styleSheet colorAt:#'menuPanel.buttonShadowColor'
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1342
!
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1343
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1344
disabledEtchedForegroundColor
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1345
    "return the color used for etching disabled items.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1346
     If nil, no 3D effect is drawn.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1347
    "
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1348
    ^ styleSheet colorAt:#'menuPanel.disabledEtchedFgColor'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1349
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1350
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1351
disabledForegroundColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1352
    "return the foreground color used by disabled items
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1353
    "
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1354
    ^ styleSheet colorAt:#'menuPanel.disabledForegroundColor'
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1355
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1356
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1357
enteredBackgroundColor
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1358
    "return the background color for entered items
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1359
    "
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1360
    ^ styleSheet colorAt:#'menu.enteredBackgroundColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1361
                 default:(self backgroundColor)
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1362
!
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1363
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1364
enteredForegroundColor
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1365
    "return the foreground color for entered items
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1366
    "
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1367
    ^ styleSheet colorAt:#'menu.enteredForegroundColor' default:fgColor
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1368
!
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1369
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1370
font:aFont
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1371
    "set the font
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1372
    "
829
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  1373
    (aFont notNil and:[aFont ~= font]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1374
	super font:(aFont "onDevice:device").
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1375
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1376
	superMenu notNil ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1377
	    self extent:(self preferredExtent)
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1378
	].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1379
	self mustRearrange.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1380
    ]
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1381
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1382
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1383
foregroundColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1384
    "return the passive foreground color
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1385
    "
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1386
    ^ fgColor
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1387
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1388
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1389
foregroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1390
    "set the foregroundColor drawing color. You should not use this method;
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1391
     instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1392
    "
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1393
    aColor ~= fgColor ifTrue:[
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1394
        fgColor := aColor onDevice:device.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1395
        shown ifTrue:[ self invalidate ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1396
    ].
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  1397
!
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  1398
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1399
maxAbsoluteButtonLevel
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1400
    "returns the maximum absolute button level; used to compute the preferred
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1401
     extent of a button
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1402
    "
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1403
    ^ styleSheet at:#'menuPanel.maxAbsoluteButtonLevel'
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1404
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1405
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1406
selectionFrameBrightColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1407
    "get the selection frame bright color
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1408
    "
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1409
    ^ Color white
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1410
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1411
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1412
selectionFrameDarkColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1413
    "get the selection frame dark color
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1414
    "
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1415
    ^ Color black
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1416
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1417
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1418
setFont:aFont
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  1419
    "set the font if the argument is nonNil; 
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  1420
     Return nil, if the font was unchanged; otherwise, return the old font"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  1421
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1422
    |currentFont|
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1423
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1424
    (aFont notNil and:[aFont ~= font]) ifTrue:[
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  1425
        currentFont := font.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  1426
        super font:aFont.
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1427
    ].
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1428
    ^ currentFont
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1429
! !
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1430
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1431
!MenuPanel methodsFor:'accessing-dimensions'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1432
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1433
height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1434
    "default height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1435
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1436
    (explicitExtent ~~ true) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1437
	^ self preferredExtent y
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1438
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1439
    ^ super height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1440
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1441
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1442
maxExtent
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1443
    "CLAUS: returns the maximum extent
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1444
    "
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1445
    |x y|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1446
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1447
    device isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1448
	superMenu notNil ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1449
	    ^ superMenu maxExtent
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1450
	].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1451
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1452
    y := device usableHeight - 2.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1453
    x := device usableWidth  - 2.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1454
  ^ x@y
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1455
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1456
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1457
preferredExtent
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1458
    "compute and returns my preferred extent
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1459
    "
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1460
    |maxExtent usedExtent|
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1461
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1462
    preferredExtent notNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1463
        ^ preferredExtent
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1464
    ].
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1465
    maxExtent  := self maxExtent.
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1466
    usedExtent := self preferredExtentOfItems.
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1467
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1468
    superView isNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1469
        "/ is standalone
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  1470
        preferredWidth notNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1471
            usedExtent x < preferredWidth ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1472
                usedExtent := preferredWidth @ usedExtent y.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1473
            ]
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1474
        ]
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1475
    ].
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1476
        
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1477
    ^ usedExtent min:maxExtent
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1478
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1479
    "Modified: / 10.10.2001 / 14:57:25 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1480
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1481
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1482
preferredExtentOfItems
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1483
    "compute and returns my preferred extent including all items
1723
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  1484
        !!!!!! changes have influence on method #rearrangeItems !!!!!!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1485
    "
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1486
    |hasMenu shCtKey extent showAcc sck
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1487
     x            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1488
     y            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1489
     size         "{ Class:SmallInteger }"
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1490
     buttonInsetX "{ Class:SmallInteger }"
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1491
     buttonInsetY "{ Class:SmallInteger }"
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1492
     labelInsetX  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1493
     labelInsetY  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1494
     itemSpace    "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1495
     itemMargin   "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1496
     groupDividerSize "{ Class:SmallInteger }"
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  1497
    |
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1498
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1499
    (size := items size) == 0 ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1500
        self isViewWrapper ifTrue:[ ^ subViews first extent ].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  1501
        ^ 32 @ 32
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1502
    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1503
    buttonInsetX := 2 * self buttonInsetX.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1504
    buttonInsetY := 2 * self buttonInsetY.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1505
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1506
    self isPopUpView ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1507
        labelInsetX := labelInsetY := 2 * (self enteredLevel abs).
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1508
    ] ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1509
        labelInsetX := labelInsetY := 0.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1510
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1511
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1512
    x := 0.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1513
    y := 0.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1514
    groupDividerSize := self groupDividerSize.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1515
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1516
    self verticalLayout ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1517
        itemSpace := self itemSpace.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1518
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1519
        items keysAndValuesDo:[:key :el| |eX eY|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1520
            extent := el preferredExtent.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1521
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1522
            "/ check for visibility (extent x ~~ 0)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1523
            (eX := extent x) ~~ 0 ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1524
                eY := extent y.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1525
                
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1526
                el isButton ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1527
                    eX := eX + buttonInsetX.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1528
                    eY := eY + buttonInsetY.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1529
                ] ifFalse:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1530
                    eX := eX + labelInsetX.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1531
                    eY := eY + labelInsetY.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1532
                ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1533
                key ~~ size ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1534
                    (self hasGroupDividerAt:key) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1535
                        x := x + groupDividerSize
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1536
                    ] ifFalse:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  1537
                        el needsItemSpaceWhenDrawing ifTrue:[
1723
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  1538
                            x := x + itemSpace
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  1539
                        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1540
                    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1541
                ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1542
                x := eX + x.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1543
                y := eY max:y.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1544
            ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1545
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1546
    ] ifTrue:[
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1547
        hasMenu := false.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1548
        shCtKey := 0.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1549
        showAcc := MenuView showAcceleratorKeys == true.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1550
        y := x.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1551
        x := 0.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1552
        itemMargin := 2 * self itemMargin.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1553
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1554
        items keysAndValuesDo:[:key :el| |eX eY|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1555
            extent := el preferredExtent.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1556
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1557
            "/ check for visibility (extent x ~~ 0)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1558
            (eX := extent x) ~~ 0 ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1559
                eY := extent y.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1560
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1561
                el isButton ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1562
                    eX := eX + buttonInsetX.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1563
                    eY := eY + buttonInsetY.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1564
                ] ifFalse:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1565
                    eX := eX + labelInsetX.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1566
                    eY := eY + labelInsetY.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1567
                ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1568
                hasMenu ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1569
                    hasMenu := el hasSubmenu
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1570
                ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1571
                (showAcc and:[(sck := el shortcutKeyAsString) notNil]) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1572
                    shCtKey := shCtKey max:(sck widthOn:self)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1573
                ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1574
                key ~~ size ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1575
                    (self hasGroupDividerAt:key) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1576
                        y := y + groupDividerSize
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1577
                    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1578
                ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1579
                y := eY + y.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1580
                x := eX max:x.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1581
            ].
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1582
        ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1583
        x := x + itemMargin.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1584
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1585
        (hasMenu or:[shCtKey ~~ 0]) ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1586
            shortKeyInset := x + Item labelRightOffset.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1587
            x := shortKeyInset + shCtKey + self subMenuIndicationWidth.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1588
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1589
            (shCtKey ~~ 0 and:[hasMenu]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1590
                x := x + self shortcutKeyOffset. 
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1591
            ]
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1592
        ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1593
"/ to have a small inset
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1594
        y := y + 1.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1595
"/        x := x + 1.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1596
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1597
    x := x + margin + margin.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1598
    y := y + margin + margin.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1599
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  1600
    ^ x @ y
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1601
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1602
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1603
preferredWidth:aWidthOrNil
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1604
    "used for example by combo box to setup the preferred width for the popup menu.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1605
     If nil (default), the width is computed from the contained items.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1606
     If not nil, the width is the maximum from the contained items and the required width.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1607
    "
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1608
    preferredWidth := aWidthOrNil.
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1609
!
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1610
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1611
shortKeyInset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1612
    "left inset of shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1613
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1614
  ^ shortKeyInset
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1615
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1617
subMenuIndicationWidth
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1618
    ^ self rightArrow width
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1619
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1620
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1621
!MenuPanel methodsFor:'accessing-interactors'!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1622
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1623
iconIndicationDisabledOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1624
    ^ self registerImageOnDevice:(self class iconIndicationDisabledOff)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1625
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1626
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1627
iconIndicationDisabledOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1628
    ^ self registerImageOnDevice:(self class iconIndicationDisabledOn)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1629
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1630
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1631
iconIndicationOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1632
    ^ self registerImageOnDevice:(self class iconIndicationOff)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1633
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1634
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1635
iconIndicationOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1636
    ^ self registerImageOnDevice:(self class iconIndicationOn)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1637
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1638
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1639
iconRadioGroupDisabledOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1640
    ^ self registerImageOnDevice:(self class iconRadioGroupDisabledOff)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1641
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1642
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1643
iconRadioGroupDisabledOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1644
    ^ self registerImageOnDevice:(self class iconRadioGroupDisabledOn)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1645
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1646
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1647
iconRadioGroupOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1648
    ^ self registerImageOnDevice:(self class iconRadioGroupOff)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1649
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1650
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1651
iconRadioGroupOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1652
    ^ self registerImageOnDevice:(self class iconRadioGroupOn)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1653
! !
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1654
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1655
!MenuPanel methodsFor:'accessing-items'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1656
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1657
itemAt:stringOrNumber do:aOneArgBlock
2505
56607624d05a Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents: 2504
diff changeset
  1658
    "evaluate the block for an item and return the result from the block. In case that  
56607624d05a Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents: 2504
diff changeset
  1659
     the item does not exist nil is returned"
56607624d05a Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents: 2504
diff changeset
  1660
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1661
    ^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1662
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1663
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1664
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1665
    "evaluate teh block for an item and return the result from the block. In case that  
2505
56607624d05a Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents: 2504
diff changeset
  1666
     the item does not exists the result of the exception block is returned (no arguments)"
56607624d05a Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents: 2504
diff changeset
  1667
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1668
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1669
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1670
    item := self itemAt:stringOrNumber.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1671
    item notNil ifTrue:[ ^ aOneArgBlock value:item ].
2505
56607624d05a Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents: 2504
diff changeset
  1672
    ^ exceptionBlock value
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1673
!
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1674
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1675
itemAtIndex:anIndex
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1676
    "returns item at an index or nil
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1677
    "
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1678
    ^ items notNil ifTrue:[items at:anIndex ifAbsent:nil] ifFalse:[nil]
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1679
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1680
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1681
items
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1682
    "returns list of items or nil
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1683
    "
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1684
    ^ items
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1685
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1686
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1687
!MenuPanel methodsFor:'accessing-look'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1688
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1689
buttonActiveLevel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1690
    "get the button active level
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1691
    "
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1692
    ^ styleSheet at:#'menuPanel.buttonActiveLevel'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1693
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1694
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1695
buttonPassiveLevel
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1696
    "get the button active level
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1697
    "
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1698
    ^ styleSheet at:#'menuPanel.buttonPassiveLevel'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1699
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1700
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  1701
centerItems
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  1702
    ^ centerItems ? false
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  1703
!
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  1704
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  1705
centerItems:aBoolean
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  1706
    centerItems := aBoolean
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  1707
!
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  1708
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1709
fitFirstPanel
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1710
    "gets true if the first panel in the menu hierarchy must be fit 
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1711
     to the extent of its superView
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1712
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1713
     NOT SUPPORTED
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1714
    "
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1715
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1716
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1717
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1718
fitFirstPanel:aState
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1719
    "sets true if the first panel in the menu hierarchy must be fit 
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1720
     to the extent of its superView
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1721
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1722
     NOT SUPPORTED
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1723
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1724
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1725
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1726
level:anInt
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  1727
    anInt ~~ level ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1728
	super level:anInt.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1729
	self mustRearrange
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  1730
    ]
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1731
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1732
    "Modified: / 15.11.2001 / 17:42:07 / cg"
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1733
!
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1734
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1735
rightArrow
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  1736
    rightArrow isNil ifTrue:[
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  1737
        device isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1738
            ^ SelectionInListView rightArrowFormOn:Display
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1739
        ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1740
        rightArrow := SelectionInListView rightArrowFormOn:device
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1741
    ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1742
    ^ rightArrow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1743
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1744
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1745
rightArrowShadow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1746
    ^ rightArrowShadow
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1747
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1748
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1749
showGroupDivider
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1750
    "get the enabled flag for showing groupDiveders
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1751
    "
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1752
    ^ showGroupDivider
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1753
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1754
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1755
showGroupDivider:aState
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1756
    "set the enabled flag for showing groupDiveders
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1757
    "
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1758
    showGroupDivider ~~ aState ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1759
        showGroupDivider := aState.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1760
        self mustRearrange.
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1761
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1762
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1763
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1764
showSeparatingLines
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1765
    "gets true if drawing of separating lines is enabled.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1766
    "
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1767
    ^ showSeparatingLines
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1768
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1769
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1770
showSeparatingLines:aState
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1771
    "turn on/off drawing of separating lines.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1772
    "
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1773
    aState ~~ showSeparatingLines ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1774
        showSeparatingLines := aState.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1775
        self mustRearrange
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1776
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1777
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1778
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1779
verticalLayout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1780
    "get the layout: or vertical( true ) or horizontal( false )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1781
    "
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  1782
    verticalLayout notNil ifTrue:[ ^ verticalLayout ].
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1783
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1784
    superMenu notNil ifTrue:[ verticalLayout := true ]
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1785
                    ifFalse:[ verticalLayout := self isPopUpView ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1786
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  1787
    ^ verticalLayout
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1788
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1789
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1790
verticalLayout:aState
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1791
    "set the layout: or vertical( true ) or horizontal( false )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1792
    "
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1793
    aState ~~ verticalLayout ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1794
        verticalLayout isNil ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1795
            verticalLayout := aState
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1796
        ] ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1797
            verticalLayout := aState.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1798
            self mustRearrange.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1799
        ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1800
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1801
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1802
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1803
!MenuPanel methodsFor:'accessing-style'!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1804
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1805
buttonInsetX
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1806
    "returns the verical button space
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1807
    "
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1808
    ^ styleSheet at:#'menuPanel.buttonInsetX'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1809
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1810
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1811
buttonInsetY
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1812
    "returns the verical button space
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1813
    "
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1814
    ^ styleSheet at:#'menuPanel.buttonInsetY'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1815
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1816
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1817
enteredLevel
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1818
    "returns the enter-level for an unselected item moved through
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1819
    "
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1820
    ^ styleSheet at:#'menu.enteredLevel'  default:0
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1821
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1822
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1823
groupDividerSize
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1824
    "returns the width of a group divider
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1825
    "
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1826
    ^ styleSheet at:#'menu.groupDividerSize' default:6
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1827
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1828
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1829
itemMargin
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1830
    "returns the margin of an item
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1831
    "
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1832
    ^ styleSheet at:#'menu.itemMargin' default:0
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1833
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1834
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1835
itemSpace
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1836
    "returns the additional space for an item in a (vertical) panel
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1837
    "
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1838
    ^ styleSheet at:#'menuPanel.itemSpace'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1839
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1840
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1841
selectionFollowsMouse
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1842
    "returns true if the selection follows the mouse
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1843
    "
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1844
    ^ styleSheet at:#'menu.selectionFollowsMouse' default:false
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1845
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1846
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1847
shortcutKeyOffset
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1848
    "returns the offset for a shortcutKey
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1849
    "
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1850
    ^ 5
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1851
! !
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1852
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1853
!MenuPanel methodsFor:'accessing-submenu'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1854
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1855
subMenuAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1856
    "gets the submenu of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1857
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1858
  ^ self itemAt:stringOrNumber do:[:el| el submenu ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1859
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1860
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1861
subMenuAt:stringOrNumber put:aSubMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1862
    "sets the submenu of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1863
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1864
    self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1865
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1866
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1867
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1868
subMenuShown
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1869
    "return the currently visible submenu - or nil if there is none
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1870
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1871
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1872
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1873
    (item := self selection) notNil ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1874
	^ item submenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1875
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1876
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1877
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1878
2504
0ce78a73aacf method category rename
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
  1879
!MenuPanel methodsFor:'activation & deactivation'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1880
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  1881
closeMenus
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  1882
    "close all menus; operation is done; nothing accepted
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  1883
    "
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  1884
    self topMenu accept:nil.
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  1885
!
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  1886
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1887
hide
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1888
    "hide the view, leave its modal event loop
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1889
    "
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1890
2407
d8cdc13f677b checkin from browser
penk
parents: 2374
diff changeset
  1891
    "/ TODO: replace with LeaveSignal raise.
d8cdc13f677b checkin from browser
penk
parents: 2374
diff changeset
  1892
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1893
    self selection:nil.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1894
    self unmap.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1895
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1896
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1897
show
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1898
    "realize the view at its last position;
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1899
     return the value of the selectedItem or nil, of none was selected
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1900
     (unless the menu has already performed its action, by sending an appropriate message
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1901
      to some performer)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1902
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1903
  ^ self showAt:(self origin) resizing:true
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1904
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1905
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1906
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1907
showAt:aPoint
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1908
    "realize the view at aPoint.
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1909
     return the value of the selectedItem or nil, of none was selected
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1910
     (unless the menu has already performed its action, by sending an appropriate message
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1911
      to some performer)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1912
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1913
  ^ self showAt:aPoint resizing:true
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1914
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1915
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1916
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1917
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1918
showAt:aPoint resizing:aBoolean
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1919
    "realize the view at aPoint; return nil if no item was selected,
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1920
     or if I have already performed.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1921
     Return the items value, otherwise.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1922
     Notice, that this is returned back to the one who started this
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1923
     menu (i.e. the view or controller), which will perform the action
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1924
     if a non-nil is returned.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1925
    "
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1926
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  1927
    self rearrangeItemsIfItemVisibilityChanged.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1928
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1929
    aBoolean ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1930
	self fixSize.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1931
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1932
    self origin:aPoint.
1459
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  1933
"/    self makeFullyVisible.   -- done in realize
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1934
    self openModal:[true]. "realize     "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1935
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1936
    "/ if I have already performed,
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1937
    "/ return nil - to avoid items triggering twice.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1938
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1939
    (self topMenu menuAdornmentAt:#hasPerformed) == true ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1940
	^ nil
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1941
    ].
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1942
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1943
    ^ self lastValueAccepted
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1944
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1945
    "Modified: / 15.9.1998 / 12:50:23 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1946
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1947
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1948
showAtPointer
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1949
    "realize the view at the current pointer position.
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1950
     return the value of the selectedItem or nil, of none was selected
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1951
     (unless the menu has already performed its action, by sending an appropriate message
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1952
      to some performer)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1953
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1954
  ^ self showAt:(device pointerPosition) resizing:true
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1955
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1956
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1957
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1958
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1959
showCenteredIn:aView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1960
    "make myself visible at the screen center.
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1961
     return the value of the selectedItem or nil, of none was selected
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1962
     (unless the menu has already performed its action, by sending an appropriate message
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1963
      to some performer)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1964
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1965
    |top|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1966
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1967
    top := aView topView.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1968
    top raise.
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1969
    ^ self showAt:(top origin + (aView originRelativeTo:top) + (aView extent // 2) - (self extent // 2))
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1970
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1971
    "Modified: / 15.9.1998 / 12:45:50 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1972
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1973
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1974
startUp
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1975
    "realize the menu at the current pointer position
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1976
     return the value of the selectedItem or nil, of none was selected
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1977
     (unless the menu has already performed its action, by sending an appropriate message
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1978
      to some performer)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1979
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1980
    ^ self showAtPointer
897
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1981
!
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1982
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1983
startUpAt:aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1984
    "realize the menu at aPoint
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1985
     return the value of the selectedItem or nil, of none was selected
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1986
     (unless the menu has already performed its action, by sending an appropriate message
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1987
      to some performer)
897
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1988
    "
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1989
    ^ self showAt:aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1990
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1991
    "Created: / 21.5.1998 / 14:15:57 / cg"
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  1992
!
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  1993
2332
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  1994
startUpFor:originatingWidget
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  1995
    "realize the menu at the current pointer position
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  1996
     return the value of the selectedItem or nil, of none was selected
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  1997
     (unless the menu has already performed its action, by sending an appropriate message
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  1998
      to some performer)
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  1999
    "
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2000
    originator := originatingWidget.
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2001
    ^ self startUp
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2002
!
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2003
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2004
startUpOrNil
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2005
    "realize the menu at the current pointer position
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2006
     return the value of the selectedItem or nil, of none was selected
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2007
     (unless the menu has already performed its action, by sending an appropriate message
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2008
      to some performer)
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2009
    "
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2010
    ^ self showAtPointer
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2011
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2012
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2013
!MenuPanel methodsFor:'adding & removing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2014
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2015
createAtIndex:anIndexOrNil
1800
600f247a2846 comment
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  2016
    "create an item and add this item to the index. In case of nil, the item
600f247a2846 comment
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  2017
     is added to the end. If the index is not valid nil is returned;
600f247a2846 comment
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  2018
     otherwise the new created item is returned.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2019
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2020
    |max item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2021
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2022
    max := (items size) + 1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2023
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2024
    anIndexOrNil notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2025
	(anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2026
	    ^ nil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2027
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2028
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2029
    items isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2030
	items := OrderedCollection new
1151
199863d6a463 items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents: 1137
diff changeset
  2031
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2032
	items := items asOrderedCollection
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2033
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2034
    item := Item in:self.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2035
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2036
    (anIndexOrNil isNil or:[anIndexOrNil == max]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2037
	items add:item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2038
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2039
	items add:item beforeIndex:anIndexOrNil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2040
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2041
    ^ item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2042
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2043
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2044
remove:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2045
    "remove the first item which is assigned to stringOrNumber;
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2046
     if found, remove and return it
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2047
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2048
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2049
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2050
    (item := self itemAt:stringOrNumber) notNil ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2051
	items remove:item.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2052
	item  destroy.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2053
	items isEmpty ifTrue:[items := nil].
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2054
	self mustRearrange.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2055
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2056
  ^ item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2057
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2058
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2059
removeAll
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2060
    "remove all items and submenus
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2061
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2062
    self disabledRedrawDo:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2063
	self selection:nil.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2064
	groupSizes := nil.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2065
	items notNil ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2066
	    items copy do:[:el| el destroy ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2067
	].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2068
	items := nil
2050
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
  2069
    ].
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
  2070
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
  2071
    "Modified: / 15.11.2001 / 17:02:51 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2072
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2073
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2074
!MenuPanel methodsFor:'change & update'!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2075
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2076
update:something with:aParameter from:changedObject
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2077
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2078
    changedObject == menuHolder    ifTrue:[^ self menu:(menuHolder value)].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2079
    changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2080
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2081
    super update:something with:aParameter from:changedObject
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2082
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2083
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2084
!MenuPanel methodsFor:'converting'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2085
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2086
asMenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2087
    "convert contents to menu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2088
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2089
    |menu|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2090
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2091
    menu := Menu new.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2092
    menu groupSizes:groupSizes.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2093
    self do:[:anItem| menu addItem:(anItem asMenuItem) ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  2094
    ^ menu
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2095
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2096
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2097
fromSpec:aMenuSpec
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2098
    "build from spec
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2099
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2100
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2101
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2102
    menu := Menu new.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2103
    menu fromLiteralArrayEncoding:aMenuSpec.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2104
    self menu:menu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2105
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2106
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2107
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2108
menu:aMenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2109
    "convert to Menu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2110
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2111
    self disabledRedrawDo:[
2232
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2112
        |menu newItems menuReceiver|
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2113
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2114
        self removeAll.
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2115
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2116
        (menu := aMenu) notNil ifTrue:[
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2117
            (aMenu isCollection) ifTrue:[
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2118
                menu := Menu new.
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2119
                menu fromLiteralArrayEncoding:aMenu.
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2120
            ] ifFalse:[
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2121
                menuReceiver := menu receiver.        
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2122
                menuReceiver notNil ifTrue:[
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2123
                    receiver := menuReceiver.
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2124
                ]
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2125
            ].
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2126
            (newItems := menu menuItems) size > 0 ifTrue:[
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2127
                items := newItems collect:[:ni | 
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2128
                                |i|
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2129
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2130
                                i:= Item in:self.
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2131
                                i menuItem:ni.
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2132
                                i.
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2133
                            ].
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2134
            ].
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2135
            self groupSizes:(menu groupSizes).
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2136
        ]
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2137
    ]
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2138
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2139
    "Modified: / 8.8.1998 / 02:05:04 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2140
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2141
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2142
!MenuPanel methodsFor:'drawing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2143
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2144
disabledRedrawDo:aBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2145
    "evaluate a block without redrawing within the block; after processing
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2146
     of the block a redraw might be performed
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2147
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2148
    |state|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2149
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2150
    state := mustRearrange.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2151
    mustRearrange := true.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2152
    aBlock value.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2153
    mustRearrange := state.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2154
    self mustRearrange
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2155
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2156
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2157
drawButtonEdgesFor:anItem level:aLevel
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2158
    |layout|
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2159
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2160
    aLevel ~~ 0 ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2161
        layout := anItem layout.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2162
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2163
        styleSheet is3D ifFalse:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2164
            self displayRectangle:layout.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2165
        ] ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2166
            self drawEdgesForX:(layout left)
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2167
                             y:(layout top)
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2168
                         width:(layout width)
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2169
                        height:(layout height)
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2170
                         level:aLevel 
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2171
                        shadow:(self buttonShadowColor) 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2172
                         light:(self buttonLightColor)
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2173
                    halfShadow:(self buttonHalfShadowColor) 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2174
                     halfLight:(self buttonHalfLightColor)
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2175
                         style:(self buttonEdgeStyle)
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2176
        ]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2177
    ]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2178
!
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2179
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2180
drawItemsX:x y:y width:w height:h
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2181
    "redraw items and groups in a damage
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2182
    "
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2183
    |isVertical item layout prevClip
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2184
     x1             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2185
     x2             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2186
     y1             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2187
     y2             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2188
     start          "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2189
     stop           "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2190
     size           "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2191
     groupDivInset  "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2192
    |
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2193
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2194
    size := items size.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2195
    isVertical := self verticalLayout.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2196
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2197
    isVertical ifTrue:[
2064
0e0d1fe431fb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  2198
        start := items findFirst:[:el| |l| l := el layout. l notNil and:[l bottom > y]].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2199
        start == 0 ifTrue:[ ^ self ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2200
        y1 := y + h.
2064
0e0d1fe431fb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  2201
        stop := items findFirst:[:el| |l| l := el layout. l notNil and:[l top > y1] ] 
0e0d1fe431fb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  2202
                     startingAt:(start + 1).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2203
    ] ifFalse:[
2064
0e0d1fe431fb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  2204
        start := items findFirst:[:el| |l| l := el layout. l notNil and:[l right > x ]].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2205
        start == 0 ifTrue:[ ^ self ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2206
        x1  := x + w.
2064
0e0d1fe431fb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  2207
        stop := items findFirst:[:el| |l| l := el layout.l notNil and:[l left > x1]] 
0e0d1fe431fb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  2208
                     startingAt:(start + 1).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2209
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2210
    stop  == 0 ifTrue:[stop := size] ifFalse:[stop := stop - 1].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2211
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2212
    (groupSizes size ~~ 0 and:[showGroupDivider]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2213
        groupDivInset := self groupDividerSize // 2.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2214
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2215
        groupDivInset ~~ 0 ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2216
            (start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2217
                start := start - 1
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2218
            ]
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2219
        ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2220
    ] ifFalse:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2221
        groupDivInset := 0
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2222
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2223
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2224
    prevClip := clipRect.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2225
    self clippingRectangle:(Rectangle left:x top:y width:w height:h).
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2226
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2227
    start to:stop do:[:i|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2228
        item := items at:i.
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  2229
        item draw.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2230
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2231
        (groupDivInset ~~ 0 and:[i ~~ size and:[self hasGroupDividerAt:i]]) ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2232
            layout := item layout.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2233
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2234
            isVertical ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2235
                x1 := layout left.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2236
                x2 := layout right.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2237
                y1 := layout bottom + groupDivInset.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2238
                y2 := y1.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2239
            ] ifFalse:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2240
                y1 := layout top.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2241
                y2 := layout bottom.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2242
                x1 := layout right + groupDivInset.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2243
                x2 := x1.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2244
            ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2245
            self paint:shadowColor.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2246
            self displayLineFromX:x1 y:y1 toX:x2 y:y2.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2247
            self paint:lightColor.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2248
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2249
            isVertical ifTrue:[y1 := y1 + 1. y2 := y1 ]
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2250
                      ifFalse:[x1 := x1 + 1. x2 := x1 ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2251
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2252
            self displayLineFromX:x1 y:y1 toX:x2 y:y2
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2253
        ]
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2254
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2255
    self clippingRectangle:prevClip.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2256
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2257
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2258
drawLabelEdgeFor:anItem selected:isSelected
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2259
    |level layout|
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2260
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2261
    isSelected ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2262
        level := styleSheet at:#'menu.hilightLevel' default:0.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2263
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2264
        anItem == enteredItem ifTrue:[ level := self enteredLevel ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2265
                             ifFalse:[ level := 0 ]
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2266
    ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2267
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2268
    level ~~ 0 ifTrue:[
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2269
        layout := anItem layout.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2270
1691
8e1a9d7a298e bugfix in drawLableEdge...
ca
parents: 1690
diff changeset
  2271
        self drawEdgesForX:(layout left)
8e1a9d7a298e bugfix in drawLableEdge...
ca
parents: 1690
diff changeset
  2272
                         y:(layout top)
8e1a9d7a298e bugfix in drawLableEdge...
ca
parents: 1690
diff changeset
  2273
                     width:(layout width)
8e1a9d7a298e bugfix in drawLableEdge...
ca
parents: 1690
diff changeset
  2274
                    height:(layout height)
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2275
                     level:level
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2276
    ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2277
!
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2278
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2279
drawScrollerAt:aDirection bounds:bounds
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2280
    "draw a scroller
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2281
    "
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2282
    |scrolling icon level x y w h|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2283
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2284
    x := bounds left.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2285
    y := bounds top.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2286
    w := bounds width.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2287
    h := bounds height.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2288
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  2289
    scrolling := self scrollActivity.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2290
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2291
    (scrolling activeMenu == self and:[scrolling direction == aDirection]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2292
	level := -2
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2293
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2294
	level := 1
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2295
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2296
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2297
    level ~~ 0 ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2298
	self drawEdgesForX:x y:y width:w height:h level:level.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2299
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2300
    icon := scrolling iconAt:aDirection on:self.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2301
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2302
    icon displayOn:self x:(x + (w - icon width  // 2))
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2303
			y:(y + (h - icon height // 2)).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2304
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2305
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2306
invalidateItem:anItem repairNow:aBool
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2307
    "an item changed; invalidate the items layout
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2308
    "
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2309
    |layout|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2310
2073
26c30a04413d do not invalidate if sensor is nil
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  2311
    self sensor isNil ifTrue:[^ self].
26c30a04413d do not invalidate if sensor is nil
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  2312
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2313
    (mustRearrange not and:[shown]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2314
	layout := anItem layout.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2315
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2316
	(layout bottom > margin and:[layout top < (height - margin)]) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2317
	    self invalidate:(layout copy insetBy:-1) repairNow:aBool
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2318
	]
1728
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2319
    ].
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2320
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2321
    "Modified: / 29.2.2000 / 11:28:59 / cg"
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  2322
!
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  2323
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2324
mustRearrange
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  2325
    "force rearrange (i.e. set the rearrange flag)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2326
    "
2080
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2327
    mustRearrange ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2328
	mustRearrange := true.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2329
	shown ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2330
	    self invalidate "/ RepairNow:true
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2331
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2332
    ]
590
3177528b5f95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  2333
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  2334
    "Modified: / 6.6.1998 / 19:51:07 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2335
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2336
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2337
rearrangeGroups
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2338
    "implements the groupIdentifier #right in a horizontal menu
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2339
    "
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2340
    |layout point
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2341
     dltX  "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2342
     start "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2343
    |
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2344
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2345
    (self isPopUpView or:[self verticalLayout]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2346
	^ self
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2347
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2348
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2349
    layout := items last layout.
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2350
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2351
    (dltX := width - margin - layout right) <= 0 ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2352
	^ self  "/ no free space
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2353
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2354
    start := items findFirst:[:anItem| anItem startGroup == #right ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2355
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2356
    start == 0 ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2357
	^ self  "/ no item detected
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2358
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2359
    point := dltX @ 0.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2360
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2361
    "/ move items layout to right
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2362
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2363
    items from:start do:[:anItem|
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2364
	anItem isVisible ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2365
	    anItem layout moveBy:point.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2366
	]
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2367
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2368
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2369
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2370
rearrangeItems
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2371
    "recompute the layout of each item
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2372
        !!!!!! changes have influence on method #preferredExtentOfItems !!!!!!
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2373
    "
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2374
    |isVertical extent isPopUpMenu
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2375
     x            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2376
     y            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2377
     x0           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2378
     y0           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2379
     x1           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2380
     y1           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2381
     size         "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2382
     insetX       "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2383
     insetY       "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2384
     labelInsetX  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2385
     labelInsetY  "{ Class:SmallInteger }"
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2386
     buttonInsetX "{ Class:SmallInteger }"
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2387
     buttonInsetY "{ Class:SmallInteger }"
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2388
     itemMargin   "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2389
     itemSpace    "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2390
     groupDividerSize "{ Class:SmallInteger }"
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2391
    |
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2392
    (mustRearrange and:[(size := items size) ~~ 0]) ifFalse:[
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2393
        mustRearrange := false.
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  2394
        ^ self
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2395
    ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2396
2080
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2397
"/  DON'T SET THIS!!
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2398
"/  item layout:  below of first item -> item invalidate 
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2399
"/                                    -> menuPanel invalidateItem:repairDamage: 
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2400
"/                                    -> invalidate:rapairDamage:
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2401
"/                                    -> redrawX:y:width:height:
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2402
"/                                    tries to get uninitialized layout from second item.
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2403
"/ This happens in a modal debugger!!
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2404
"/    mustRearrange := false.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2405
    isVertical       := self verticalLayout.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2406
    itemSpace        := self itemSpace.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2407
    groupDividerSize := self groupDividerSize.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2408
    buttonInsetX     := self buttonInsetX.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2409
    buttonInsetY     := self buttonInsetY.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2410
    isPopUpMenu      := self isPopUpView.
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2411
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2412
    isPopUpMenu ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2413
        labelInsetX := labelInsetY := self enteredLevel abs.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2414
    ] ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2415
        labelInsetX := labelInsetY := 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2416
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2417
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2418
    (isPopUpMenu or:[explicitExtent ~~ true]) ifTrue:[ |savExt maxExt|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2419
        savExt := extent := self preferredExtent copy.
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2420
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2421
        isPopUpMenu ifFalse:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2422
            isVertical ifTrue:[extent y:1.0] ifFalse:[extent x:1.0]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2423
        ] ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2424
            savExt := extent copy.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2425
            maxExt := self maxExtent.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2426
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2427
            isVertical ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2428
                extent y:(extent y min:(maxExt y))
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2429
            ] ifFalse:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2430
                extent x:(extent x min:(maxExt x))
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2431
            ]
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2432
        ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2433
        self extent:extent.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2434
        extent := savExt.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2435
    ] ifFalse:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2436
        extent := self computeExtent
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2437
    ].
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2438
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  2439
    x := y := margin.
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  2440
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2441
    isVertical ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2442
        y0 := margin.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2443
        y1 := extent y - margin.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2444
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2445
        items keysAndValuesDo:[:anIndex :el|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2446
            el isVisible ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2447
                el layout:(Rectangle left:x top:y0 right:x bottom:y1)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2448
            ] ifTrue:[
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2449
                el isButton ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2450
                    insetX := buttonInsetX.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2451
                    insetY := buttonInsetY.
2062
31ba9af25394 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2061
diff changeset
  2452
                ] ifFalse:[            
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2453
                    insetX := labelInsetX.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2454
                    insetY := labelInsetY.
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2455
                ].
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2456
                x0 := x  + insetX.
2171
90a7393eb53c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2170
diff changeset
  2457
                x1 := x0 + (el preferredExtent x).
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2458
                el layout:(Rectangle left:x0 top:(y0 + insetY) right:x1 bottom:(y1 - insetY)).
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2459
                x := x1 + insetX.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2460
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2461
                size ~~ anIndex ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2462
                    (self hasGroupDividerAt:anIndex) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2463
                        x := x + groupDividerSize
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2464
                    ] ifFalse:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  2465
                        el needsItemSpaceWhenDrawing ifTrue:[
1723
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  2466
                            x := x + itemSpace
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  2467
                        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2468
                    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2469
                ]
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2470
            ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2471
        ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2472
    ] ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2473
        itemMargin := self itemMargin.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2474
        x0 := margin.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2475
        x1 := extent x - margin - itemMargin.  "/ -1
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2476
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2477
        items keysAndValuesDo:[:anIndex :el|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2478
            el isVisible ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2479
                el layout:(Rectangle left:x0 top:y right:x1 bottom:y)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2480
            ] ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2481
                el isButton ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2482
                    insetX := buttonInsetX.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2483
                    insetY := buttonInsetY.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2484
                ] ifFalse:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2485
                    insetX := labelInsetX.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2486
                    insetY := labelInsetY.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2487
                ].
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2488
                y0 := y  + insetY.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2489
                y1 := y0 + el preferredExtent y.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2490
                el layout:(Rectangle left:(x0 + insetX + itemMargin) top:y0 right:(x1 - insetX) bottom:y1).
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2491
                y := y1 + insetY.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2492
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2493
                size ~~ anIndex ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2494
                    (self hasGroupDividerAt:anIndex) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2495
                        y := y + groupDividerSize
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2496
                    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2497
                ]
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2498
            ]
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2499
        ]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2500
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2501
    self rearrangeGroups.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  2502
    selection notNil ifTrue:[self makeItemVisible:selection].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2503
    mustRearrange := false.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  2504
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  2505
    "Modified: / 13.11.2001 / 20:17:21 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2506
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2507
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2508
rearrangeItemsIfItemVisibilityChanged
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2509
    "check for items which can change its visibility;
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2510
     if at least one item exists, rearrange all items
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2511
    "
1464
3070de4c8b88 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
  2512
    items isNil ifTrue:[^ self].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2513
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2514
    items do:[:item |
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2515
	item canChangeVisibility ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2516
	    mustRearrange := true.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2517
	    self rearrangeItems.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2518
	    ^ self
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2519
	].
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2520
    ]
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2521
!
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2522
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2523
redrawX:x y:y width:w height:h
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2524
    "redraw a damage
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2525
    "
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2526
    |y0 y1 x0 x1 bounds mustDrawPrevScroller mustDrawNextScroller|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2527
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2528
    (shown and:[w ~~ 0]) ifFalse:[^ self].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2529
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2530
    mustRearrange ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2531
        self isPopUpView not ifTrue:[explicitExtent := true].
1387
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2532
        self rearrangeItems.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2533
      ^ self invalidate
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2534
    ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2535
    self paint:(self viewBackground).
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2536
    self clearRectangleX:x y:y width:w height:h.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2537
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2538
    items size == 0 ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2539
        ^ self
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2540
    ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2541
    y0 := y.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2542
    y1 := y + h.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2543
    x0 := x.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2544
    x1 := x + w.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2545
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2546
    self hasScrollers ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2547
        (self hasScrollerAt:#PREV) ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2548
            bounds := self scrollerBoundsAt:#PREV.
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2549
            mustDrawPrevScroller := false.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2550
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2551
            self verticalLayout ifTrue:[
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2552
                bounds bottom > y ifTrue:[
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2553
                    y0 := bounds bottom.
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2554
                    mustDrawPrevScroller := true.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2555
                ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2556
            ] ifFalse:[
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2557
                bounds right > x ifTrue:[
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2558
                    x0 := bounds right.
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2559
                    mustDrawPrevScroller := true.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2560
                ].
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2561
            ].
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2562
            mustDrawPrevScroller ifTrue:[
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2563
                self drawScrollerAt:#PREV bounds:bounds.
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2564
            ].
1387
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2565
        ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2566
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2567
        (self hasScrollerAt:#NEXT) ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2568
            bounds := self scrollerBoundsAt:#NEXT.
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2569
            mustDrawNextScroller := false.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2570
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2571
            self verticalLayout ifTrue:[
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2572
                bounds top < y1 ifTrue:[
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2573
                    y1 := bounds top.
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2574
                    mustDrawNextScroller := true.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2575
                ]
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2576
            ] ifFalse:[
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2577
                bounds left < x1 ifTrue:[
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2578
                    x1 := bounds left.
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2579
                    mustDrawNextScroller := true.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2580
                ]
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2581
            ].
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2582
            mustDrawNextScroller ifTrue:[
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2583
                self drawScrollerAt:#NEXT bounds:bounds.
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2584
            ].
1387
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2585
        ]
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2586
    ].
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2587
    (y1 > y0 and:[x1 > x0]) ifTrue:[
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2588
        self drawItemsX:x0 y:y0 width:(x1 - x0) height:(y1 - y0)
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2589
    ].
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2590
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2591
    "Modified: / 15.11.2001 / 20:57:32 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2592
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2593
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2594
!MenuPanel methodsFor:'enumerting & searching'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2595
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2596
collect:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2597
    "evaluate the argument, aOneArgBlock for every item in the menuPanel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2598
     and return a collection of the results
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2599
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2600
    items notNil ifTrue:[^ items collect:aOneArgBlock ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  2601
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2602
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2603
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2604
do:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2605
    "evaluate the argument, aOneArgBlock for every item in the menuPanel.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2606
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2607
    items notNil ifTrue:[ items do:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2608
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2609
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2610
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2611
findFirst:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2612
    "find the first item, for which evaluation of the argument, aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2613
     returns true; return its index or 0 if none detected.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2614
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2615
    items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2616
  ^ 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2617
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2618
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2619
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2620
findLast:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2621
    "find the last item, for which evaluation of the argument, aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2622
     returns true; return its index or 0 if none detected.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2623
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2624
    items notNil ifTrue:[ ^ items findLast:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2625
  ^ 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2626
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2627
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2628
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2629
indexOf:something
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2630
    "returns index of an item assigned to an index, nameKey, textLabel or value if symbol.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2631
     If no item match 0 is returned. No range checks are performed on a number argument
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2632
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2633
    |i v|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2634
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2635
    something isNumber ifTrue:[ ^ something ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2636
    something isNil    ifTrue:[ ^ 0 ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2637
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2638
    i := self findFirst:[:el | (el nameKey = something) or: [el = something]].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2639
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2640
    i ~~ 0 ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2641
	^ i
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2642
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2643
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2644
    something isSymbol ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2645
	i := self findFirst:[:el|
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2646
				v := el value.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2647
				v isSymbol and:[v == something]
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2648
			    ].
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2649
	i ~~ 0 ifTrue:[
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2650
	    ^ i
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2651
	]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2652
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2653
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2654
    (something respondsTo:#string) ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2655
	v := something string.
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2656
      ^ self findFirst:[:el | el textLabel = v].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2657
    ].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2658
    ^ 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2659
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2660
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2661
indexOfItem:anItem
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2662
    "returns the index of the item or 0
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2663
    "
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2664
    ^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0]
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2665
!
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2666
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2667
keysAndValuesDo:aTwoArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2668
    "evaluate the argument, aTwoArgBlock for every item in the menuPanel.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2669
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2670
    items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2671
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2672
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2673
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2674
!MenuPanel methodsFor:'event handling'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2675
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2676
buttonMotion:state x:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2677
    "open or close the corresponding submenus
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2678
    "
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  2679
    |menue motionPoint translatedPoint sensor|
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2680
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  2681
    self scrollActivity isActive ifTrue:[
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2682
        ^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2683
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2684
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2685
    sensor := self sensor.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2686
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2687
    (sensor isNil or:[sensor hasButtonMotionEventFor:nil]) ifTrue:[
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2688
        ^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2689
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2690
    menue := self detectGrabMenu.
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2691
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  2692
    motionPoint := x@y.
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  2693
    translatedPoint := menue translateGrabPoint:motionPoint.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  2694
    menue handleButtonMotion:state atPoint:translatedPoint.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2695
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2696
    hideOnRelease := true.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2697
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2698
    (self isPopUpView or:[sensor anyButtonPressed]) ifTrue:[
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2699
        ^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2700
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2701
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2702
    (selection notNil and:[selection visibleSubmenu isNil]) ifTrue:[
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2703
        "/ selection on grabView withou a submenu (Button ...); check whether moving out
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2704
        (self containsPoint:motionPoint) ifFalse:[
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2705
            ^ self accept:nil
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2706
        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2707
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2708
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  2709
    "Modified: / 13.11.2001 / 20:21:49 / cg"
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2710
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2711
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2712
buttonPress:button x:x y:y
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2713
    "any button pressed; open or close the corresponding submenus
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2714
    "
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2715
    |menu point|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2716
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2717
    hideOnRelease := true.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2718
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  2719
    self scrollActivity stop.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2720
    point := x@y.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2721
    menu  := self detectMenuAtGrabPoint:point.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2722
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2723
    menu isNil ifTrue:[
2133
293dadf237ad hide on buttonRelease outside (instead of buttonPress outside)
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2724
"/        self accept:nil
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2725
    ] ifFalse:[
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2726
        point := menu translateGrabPoint:point.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2727
        menu handleButtonPressAtPoint:point.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2728
    ]
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  2729
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  2730
    "Modified: / 13.11.2001 / 14:12:32 / cg"
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2731
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2732
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2733
buttonRelease:button x:x y:y
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2734
    "button release action; accept selection and close all views
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2735
    "
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2736
    |topMenu dstMenu item srcPoint dstPoint subm doAction|
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  2737
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  2738
    topMenu := self topMenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  2739
    topMenu openDelayed:nil.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2740
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  2741
    self scrollActivity stop ifTrue:[
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2742
        ^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2743
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2744
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2745
    dstMenu := topMenu activeMenu.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2746
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2747
    doAction := dstMenu selection notNil
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2748
                or:[dstMenu isPopUpView not].
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2749
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2750
    doAction ifFalse:[
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2751
        doAction := hideOnRelease.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2752
        ((OperatingSystem 
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2753
            millisecondTimeDeltaBetween:(Time millisecondClockValue)
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2754
            and:(dstMenu mapTime))
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2755
          > (PopUpMenu maxClickTimeToStayOpen)) ifFalse:[
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2756
            doAction := false
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2757
        ]
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2758
    ].
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2759
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2760
    doAction ifTrue:[
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2761
        srcPoint := x@y.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2762
        
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2763
        (     (dstMenu := self detectMenuAtGrabPoint:srcPoint) notNil
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2764
         and:[(item    := dstMenu selection) notNil]
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2765
        ) ifTrue:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2766
            item visibleSubmenu notNil ifTrue:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2767
                dstMenu selection:nil.
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2768
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2769
                (selection isNil and:[self isPopUpView not]) ifTrue:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2770
                    self accept:nil
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2771
                ].
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2772
                ^ self
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2773
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2774
            ].
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2775
            subm := item currentSubmenu.
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2776
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  2777
            subm notNil ifTrue:[
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2778
                subm shown ifTrue:[^ self].
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2779
                "/ test whether any action is assigned to the menu
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2780
                "/ if not ignorre accept
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2781
                item hasDelayedMenu ifFalse:[^ self].
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2782
                "/ handle action defined for the delayed menu
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2783
            ].
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2784
            dstPoint := dstMenu translateGrabPoint:srcPoint.
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2785
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2786
            (dstMenu itemAtPoint:dstPoint) == dstMenu selection ifFalse:[
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2787
                item := nil
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2788
            ].
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2789
            topMenu acceptItem:item inMenu:dstMenu.
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2790
            ^ self
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2791
        ].
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2792
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2793
        (selection notNil and:[dstMenu == self]) ifTrue:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2794
            selection visibleSubmenu notNil ifTrue:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2795
                ^ self
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2796
            ]
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2797
        ].
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2798
        self accept:nil.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2799
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2800
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2801
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2802
keyPress:key x:x y:y
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2803
    "any key is pressed
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2804
    "
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2805
    |menu superMenu sensor|
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2806
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2807
    sensor := self sensor.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  2808
    sensor isNil ifTrue:[^ self].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2809
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2810
    sensor anyButtonPressed ifTrue:[
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  2811
        ^ self  "/ ignored while any button is pressed
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2812
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2813
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  2814
    self scrollActivity isActive ifTrue:[
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2815
        key ~~ #Escape ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2816
            ^ self
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2817
        ].
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  2818
        self scrollActivity stop
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2819
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2820
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2821
       (key == #Tab 
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2822
    or:[key == #FocusNext
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2823
    or:[key == #FocusPrevious]]) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2824
        self accept:nil.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  2825
        ^ super keyPress:key x:x y:y
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2826
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2827
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2828
    menu := self detectGrabMenu.
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2829
    superMenu := menu superMenu.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2830
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2831
    key == #Escape ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2832
        "/ must hide the active menu
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2833
        (superMenu notNil and:[superMenu ~~ self]) ifTrue:[
1703
e127eff742bb bugfix: request focus
ca
parents: 1701
diff changeset
  2834
            "/ hide active menu but keep the grab
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2835
            superMenu selection:nil
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2836
        ] ifFalse:[
1703
e127eff742bb bugfix: request focus
ca
parents: 1701
diff changeset
  2837
            "/ hide active menu and ungrab
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2838
            self accept:nil
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2839
        ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2840
        ^ self
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2841
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2842
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2843
    menu isViewWrapper ifFalse:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2844
        sensor compressKeyPressEventsWithKey:key.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2845
        menu handleKeyPress:key.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  2846
        ^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2847
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2848
    superMenu == self ifFalse:[^ self].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2849
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2850
    "/ allow cursor movement
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2851
    (key == #CursorLeft or:[key == #CursorRight]) ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2852
        (self containsPoint:x@y) ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2853
            self handleKeyPress:key.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2854
        ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2855
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2856
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2857
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2858
pointerLeave:state
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2859
    |sensor|
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2860
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  2861
    self scrollActivity isActive ifTrue:[^ self].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2862
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2863
    self detectGrabMenu handlePointerLeave:state.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2864
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2865
    (selection isNil or:[self isPopUpView]) ifTrue:[
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2866
        ^ self
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2867
    ].
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2868
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  2869
    selection visibleSubmenu notNil ifTrue:[^ self].
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2870
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2871
    windowGroup focusView ~~ self ifTrue:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2872
        self accept:nil
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2873
    ] ifFalse:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2874
        selection isButton ifTrue:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2875
            sensor := self sensor.
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2876
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2877
            sensor isNil ifTrue:[
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2878
                self accept:nil
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2879
            ] ifFalse:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2880
                "/ I'have the focus; if no button pressed, than keep the selection
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2881
                sensor anyButtonPressed ifTrue:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2882
                    self selection:nil
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2883
                ]
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2884
            ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2885
        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2886
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2887
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2888
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2889
sizeChanged:how
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2890
    "redraw #right groups
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2891
    "
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2892
    self isPopUpView ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2893
	mustRearrange := true.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2894
	shown ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2895
	    self invalidate
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2896
	]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2897
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2898
    super sizeChanged:how
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2899
! !
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2900
2503
4f34d55dae21 method category rename
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  2901
!MenuPanel methodsFor:'event handling-processing'!
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2902
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2903
clearImplicitGrab
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2904
    implicitGrabView := lastPointerView := nil.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2905
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2906
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2907
dispatchEvent:ev withFocusOn:focusView delegate:doDelegate
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  2908
    "dispatch and handle an event"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  2909
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2910
    |view x y p syntheticEvent menu|
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2911
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2912
    "/ situation: we get a buttonPress, set implicitGrab (for scrollbars etc.)
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2913
    "/ but never get the buttonRelease, since someone else (a popUp) grabbed the
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2914
    "/ pointer in the meantime, and has eaten the release event ... (double-sigh)
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2915
    implicitGrabView notNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2916
        self sensor leftButtonPressed ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2917
            self clearImplicitGrab.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2918
        ].
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2919
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2920
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2921
    ((x := ev x) isNil or:[(y := ev y) isNil]) ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2922
        ^ super dispatchEvent:ev withFocusOn:focusView delegate:false.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2923
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2924
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2925
    implicitGrabView notNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2926
        ev isButtonEvent ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2927
            p := device translatePoint:(x@y) fromView:self toView:implicitGrabView.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2928
            ev view:implicitGrabView.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2929
            ev arguments at:2 put:p x.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2930
            ev arguments at:3 put:p y.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2931
            implicitGrabView dispatchEvent:ev withFocusOn:focusView delegate:false.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2932
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2933
            ev isButtonReleaseEvent ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2934
                self clearImplicitGrab.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2935
            ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2936
            ^ self
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2937
        ]
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2938
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2939
    menu := self detectMenuAtGrabPoint:(x@y).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2940
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2941
    (menu isNil or:[menu isViewWrapper not]) ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2942
        self clearImplicitGrab.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2943
      ^ super dispatchEvent:ev withFocusOn:focusView delegate:false
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2944
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2945
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2946
    p    := menu translateGrabPoint:(x@y).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2947
    view := self detectViewAtX:(p x) y:(p y) in:menu.
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  2948
    p    := device translatePoint:(x@y) fromView:self toView:view.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2949
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2950
    ev isButtonPressEvent ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2951
        (view wantsFocusWithButtonPress) ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2952
            view requestFocus.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2953
        ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2954
        view ~~ self ifTrue:[ "/ can this ever be self ?
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2955
            implicitGrabView := view.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2956
        ]
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2957
    ].
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2958
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2959
    ev isButtonMotionEvent ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2960
        lastPointerView ~~ view ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2961
            "/ must generate enter/leave ... (sigh)
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2962
            lastPointerView notNil ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2963
                "/ XXX: should be fixed
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2964
                syntheticEvent := WindowEvent pointerLeave:0 view:lastPointerView.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2965
                lastPointerView dispatchEvent:syntheticEvent withFocusOn:nil delegate:false.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2966
            ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2967
            view notNil ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2968
                syntheticEvent := WindowEvent pointerEnter:0 x:x y:y view:view.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2969
                view dispatchEvent:syntheticEvent withFocusOn:nil delegate:false.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2970
            ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2971
            lastPointerView := view.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2972
        ].
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2973
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2974
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2975
    ev view:view.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2976
    ev x:p x.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2977
    ev y:p y.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2978
    view dispatchEvent:ev withFocusOn:focusView delegate:false.
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  2979
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  2980
    "Modified: / 10.10.2001 / 13:54:47 / cg"
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2981
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2982
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  2983
handleButtonMotion:state atPoint:motionPoint
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2984
    "open or close the corresponding submenus
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2985
    "
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2986
    |menu item translatedPoint containsPoint|
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2987
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2988
    containsPoint    := self containsPoint:motionPoint.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2989
    containsPoint ifTrue:[ item := self itemAtPoint:motionPoint ]
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2990
                 ifFalse:[ item := nil ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2991
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2992
    self pointerEntersItem:item.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2993
1910
119f91172b70 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1902
diff changeset
  2994
    (state == 0 or:[self sensor anyButtonPressed not]) ifTrue:[
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2995
        "/ only update pointerEnter
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  2996
        ^ self
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  2997
    ].
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  2998
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2999
    containsPoint ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3000
        self selection:item openMenu:true.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3001
        ^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3002
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3003
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3004
    menu := self superMenuAtPoint:motionPoint.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3005
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3006
    menu notNil ifTrue:[
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3007
        translatedPoint := self translateMenuPoint:motionPoint toMenu:menu.
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3008
        menu handleButtonMotion:state atPoint:translatedPoint.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3009
        ^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3010
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3011
    self isPopUpView ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3012
        self selection:nil
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3013
    ].
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3014
!
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3015
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3016
handleButtonPressAtPoint:aPoint
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3017
    "a button pressed; open or close the corresponding submenus"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3018
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3019
    | item sensor direction wasSelected|
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3020
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3021
    item := self itemAtPoint:aPoint.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3022
    item isNil ifTrue:[
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3023
        self selection:nil openMenu:false.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3024
        ^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3025
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3026
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3027
    direction := self scrollerDirectionAtPoint:aPoint.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3028
    direction notNil ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3029
        (self scrollActivity startIfRequiredAt:direction on:self) ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3030
            self pointerEntersItem:nil.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3031
            ^ self
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3032
        ]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3033
    ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3034
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3035
    wasSelected := (selection == item).
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3036
    wasSelected ifFalse:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3037
        self selection:item openMenu:true
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3038
    ].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  3039
    item hasDelayedMenu ifTrue:[^ self].
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3040
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3041
    (item isToggle or:[item triggerOnDown]) ifFalse:[
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3042
        (wasSelected and:[item hasSubmenu and:[item visibleSubmenu isNil]]) ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3043
            item toggleSubmenuVisibility
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3044
        ].
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3045
        ^ self
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3046
    ].
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3047
    (item canAccept and:[item == self selection]) ifFalse:[
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3048
        ^ self
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3049
    ].
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3050
    self invalidateItem:item repairNow:true.
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3051
    self acceptItem:item inMenu:self.
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3052
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3053
    sensor := self sensor.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3054
    [sensor anyButtonPressed] whileTrue:[ Delay waitForSeconds:0.1 ].
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3055
    sensor flushUserEvents.
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3056
    self selection:nil.
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3057
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3058
    "Created: / 13.11.2001 / 14:12:04 / cg"
2047
62de65e3a61b initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents: 2046
diff changeset
  3059
    "Modified: / 13.11.2001 / 19:50:52 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3060
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3061
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3062
handleCursorKey:aKey
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3063
    "handle a cursor key
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3064
    "
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3065
    |next menu item isVrt backKey p1 p2
2354
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3066
     idx0  "{ Class:SmallInteger }"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3067
     idx   "{ Class:SmallInteger }"
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3068
     size  "{ Class:SmallInteger }"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3069
    |
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3070
    (size  := items size) == 0 ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3071
        superMenu notNil ifTrue:[superMenu handleCursorKey:aKey].
2354
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3072
        ^ self
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3073
    ].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3074
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3075
    isVrt := self verticalLayout.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3076
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3077
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3078
    (    (isVrt     and:[aKey == #CursorUp    or:[aKey == #CursorDown]])
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3079
     or:[(isVrt not and:[aKey == #CursorRight or:[aKey == #CursorLeft]])]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3080
    ) ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3081
        selection isNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3082
            (superMenu notNil and:[superMenu verticalLayout == isVrt]) ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3083
                ^ superMenu handleCursorKey:aKey
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3084
            ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3085
            idx := 0.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3086
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3087
            isVrt ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3088
                "/ used because of vertical scrolling
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3089
                idx := items findFirst:[:el| el layout top > 0 ].
2354
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3090
                idx ~~ 0 ifTrue:[idx := idx - 1 ]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3091
            ].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3092
        ] ifFalse:[
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3093
            idx := self indexOf:selection.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3094
        ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3095
        next := aKey == #CursorRight or:[aKey == #CursorDown].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3096
2354
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3097
        idx0 := idx.
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3098
        size timesRepeat:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3099
            |el|
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3100
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3101
            next ifTrue:[idx := idx + 1] ifFalse:[idx := idx - 1].
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3102
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3103
            idx > size ifTrue:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3104
                idx := 0 "1"
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3105
            ] ifFalse:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3106
                idx < 0 ifTrue:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3107
                    idx := size
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3108
                ] 
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3109
            ].
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3110
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3111
            idx == 0 ifTrue:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3112
                self selection:nil.
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3113
                ^ self
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3114
            ] ifFalse:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3115
                (el := items at:idx ifAbsent:nil) notNil ifTrue:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3116
                    el canSelect ifTrue:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3117
                        el hasDelayedMenu ifTrue:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3118
                            "/ do not open menu
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3119
                            self selection:el openMenu:false
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3120
                        ] ifFalse:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3121
                            "/ open comes from style-sheet
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3122
                            self selection:el.
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3123
                        ].
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3124
                        ^ self
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3125
                    ].
2354
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3126
                ]
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3127
            ].
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3128
            idx == idx0 ifTrue:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3129
                ^ self
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3130
            ].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3131
        ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3132
        ^ self
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3133
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3134
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3135
    superMenu notNil ifTrue:[
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3136
        p1 := self translateGrabPoint:0.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3137
        p2 := superMenu translateGrabPoint:0.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3138
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3139
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3140
    isVrt ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3141
        (superMenu notNil and:[p1 x > p2 x]) ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3142
            backKey := #CursorRight
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3143
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3144
            backKey := #CursorLeft.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3145
        ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3146
    ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3147
        (superMenu notNil and:[p1 y > p2 y]) ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3148
            backKey := #CursorDown
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3149
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3150
            backKey := #CursorUp.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3151
        ]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3152
    ].    
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3153
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3154
    aKey == backKey ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3155
        superMenu isNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3156
            self accept:nil
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3157
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3158
            superMenu verticalLayout ~~ isVrt ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3159
                superMenu handleCursorKey:aKey
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3160
            ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3161
                superMenu selection hideSubmenu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3162
            ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3163
        ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3164
        ^ self
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3165
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3166
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3167
    selection isNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3168
        superMenu isNil ifTrue:[^ self accept:nil].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3169
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3170
        superMenu verticalLayout ~~ isVrt ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3171
            superMenu handleCursorKey:aKey
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3172
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3173
            (item := items findFirst:[:el| el canSelect]) notNil ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3174
                self selectionIndex:item
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3175
            ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3176
        ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3177
        ^ self
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3178
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3179
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3180
    selection hasSubmenu ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3181
        (menu := selection visibleSubmenu) isNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3182
            selection toggleSubmenuVisibility
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3183
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3184
            menu selectionIndex:1
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3185
        ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3186
    ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3187
        superMenu notNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3188
            superMenu verticalLayout ~~ isVrt ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3189
                superMenu handleCursorKey:aKey
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3190
            ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3191
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3192
            self accept:nil
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3193
        ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3194
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3195
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3196
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3197
handleKeyPress:key
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3198
    "any key is pressed
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3199
    "
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3200
    |item inMenu|
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3201
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3202
    (key == #Return or:[key == Character space]) ifTrue:[
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3203
        self handleReturnPressed
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3204
    ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3205
        key isCharacter ifTrue:[
1862
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  3206
"/            selection notNil ifTrue:[
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  3207
"/                inMenu := self
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  3208
"/            ] ifFalse:[
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  3209
"/                (inMenu := superMenu) isNil ifTrue:[^ self].
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  3210
"/            ].
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  3211
            inMenu := self.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3212
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3213
            (item := inMenu detectItemForKey:key) notNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3214
                inMenu selection:item
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3215
            ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3216
        ] ifFalse:[
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3217
            (     key == #CursorDown or:[key == #CursorUp
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3218
              or:[key == #CursorLeft or:[key == #CursorRight]]]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3219
            ) ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3220
                self handleCursorKey:key
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3221
            ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3222
        ]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3223
    ]
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3224
!
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3225
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3226
handlePointerLeave:state
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3227
    self  pointerEntersItem:nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3228
    super pointerLeave:state
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3229
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3230
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3231
handleReturnPressed
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3232
    "any key is pressed"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3233
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3234
    |sensor subm item|
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3235
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3236
    (item := selection) isNil ifTrue:[
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3237
        superMenu notNil ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3238
            item := superMenu selection.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3239
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3240
            item value notNil ifTrue:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3241
                "/ is a delayed menu
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3242
                self accept:item
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3243
            ] ifFalse:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3244
                item toggleSubmenuVisibility
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3245
            ]
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3246
        ] ifFalse:[
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3247
            self accept
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3248
        ].
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3249
        ^ self
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3250
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3251
    selection hasSubmenu ifTrue:[
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3252
        selection hasDelayedMenu ifFalse:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3253
            selection toggleSubmenuVisibility.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3254
          ^ self
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3255
        ].
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3256
        subm := selection currentSubmenu.
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3257
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3258
        (subm notNil and:[subm shown]) ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3259
            selection toggleSubmenuVisibility.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3260
          ^ self
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3261
        ].
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3262
        self openDelayed:nil
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3263
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3264
    self accept.
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3265
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3266
    " test for toggle "
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3267
    item isToggle ifTrue:[
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3268
        self selection:item.
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3269
    ] ifFalse:[
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3270
        (selection notNil and:[selection triggerOnDown]) ifFalse:[
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3271
            ^ self
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3272
        ]
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3273
    ].    
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3274
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3275
    (sensor := self sensor) isNil ifTrue:[
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3276
        ^ self
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3277
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3278
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3279
    [   
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3280
        sensor flushKeyboardFor:nil.
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3281
        Delay waitForSeconds:0.1.
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3282
        sensor hasKeyPressEventFor:nil.
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3283
    ] whileTrue.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3284
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3285
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3286
pointerEntersItem:anItemOrNil
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3287
    "the pointer moves over an item or nil; restore the old item and
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3288
     redraw the new item highlighted.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3289
    "
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3290
    |oldItem newItem|
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3291
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3292
    (     anItemOrNil notNil
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3293
     and:[anItemOrNil canSelect
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3294
     and:[selection isNil
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3295
     and:[self isPopUpView not]]]) ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3296
        anItemOrNil isButton ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3297
            (    self buttonEnteredBackgroundColor ~= self buttonPassiveBackgroundColor
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3298
             or:[self buttonEnteredLevel ~= self buttonPassiveLevel]
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3299
            ) ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3300
                newItem := anItemOrNil
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3301
            ]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3302
        ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3303
            (self enteredLevel ~~ 0 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3304
              or:[self enteredBackgroundColor ~= self backgroundColor]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3305
            ) ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3306
                newItem := anItemOrNil
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3307
            ]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3308
        ]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3309
    ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3310
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3311
    newItem ~~ enteredItem ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3312
        oldItem     := enteredItem.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3313
        enteredItem := newItem.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3314
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3315
        oldItem notNil ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3316
            self invalidateItem:oldItem repairNow:(enteredItem isNil).
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3317
        ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3318
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3319
        enteredItem notNil ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3320
            self invalidateItem:enteredItem repairNow:true.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3321
        ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3322
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3323
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3324
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3325
!MenuPanel methodsFor:'focus handling'!
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3326
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3327
hasKeyboardFocus:aBoolean
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3328
    "notification from the windowGroup that I got/lost the keyboard focus.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3329
    "
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3330
    |focusView|
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3331
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3332
    self isPopUpView ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3333
        "/ not visible for popup menus
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3334
        ^ super hasKeyboardFocus:aBoolean
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3335
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3336
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3337
    (aBoolean not and:[selection notNil]) ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3338
        hasImplicitGrap ~~ true ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3339
            focusView := windowGroup focusView.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3340
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3341
            focusView == self ifFalse:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3342
                self selection:nil.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3343
            ]
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3344
        ]
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3345
    ].            
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3346
    super hasKeyboardFocus:aBoolean.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3347
! !
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3348
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3349
!MenuPanel methodsFor:'grabbing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3350
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3351
doGrab
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3352
    relativeGrabOrigin := nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3353
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3354
    superMenu notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3355
	superMenu doGrab
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3356
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3357
	hasImplicitGrap ~~ true ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3358
	    self grabMouseAndKeyboard.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3359
	    hasImplicitGrap := true
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3360
	]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3361
    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3362
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3363
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3364
doUngrab:forceDo
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3365
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3366
    relativeGrabOrigin := nil.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3367
    self clearImplicitGrab.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3368
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3369
    superMenu notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3370
	forceDo ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3371
	    superMenu doUngrab:true
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3372
	].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3373
	^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3374
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3375
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3376
    hasImplicitGrap ~~ true ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3377
	^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3378
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3379
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3380
    forceDo ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3381
	(selection notNil or:[prevFocusView == self]) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3382
	    ^ self
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3383
	].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3384
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3385
    self ungrabMouseAndKeyboard.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3386
    self selection:nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3387
    hasImplicitGrap := nil.
1703
e127eff742bb bugfix: request focus
ca
parents: 1701
diff changeset
  3388
    prevFocusView   := nil.
e127eff742bb bugfix: request focus
ca
parents: 1701
diff changeset
  3389
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3390
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3391
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3392
grabKeyboard
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3393
    "grap the keyboard; keep previous grab
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3394
    "
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3395
    previousKeyboardGrab := device activeKeyboardGrab.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3396
  ^ super grabKeyboard
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3397
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3398
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3399
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3400
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3401
grabMouseAndKeyboard
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3402
    "get exclusive access to pointer and keyboard"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3403
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3404
    |sensor|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3405
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3406
    realized ifTrue:[
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3407
        prevFocusView := self windowGroup focusView.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3408
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3409
        sensor := self sensor.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3410
        device activePointerGrab ~~ self ifTrue:[
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3411
            sensor flushMotionEventsFor:nil.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3412
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3413
            (self grabPointer) ifFalse:[
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3414
                Delay waitForSeconds:0.1.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3415
                (self grabPointer) ifFalse:[
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3416
                    "give up"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3417
                    'MenuPanel [warning]: could not grab pointer' errorPrintCR.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3418
                    self unmap
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3419
                ]
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3420
            ]
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3421
        ].
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3422
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3423
        device activeKeyboardGrab ~~ self ifTrue:[
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3424
            device sync.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3425
            sensor flushKeyboardFor:nil.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3426
            self grabKeyboard.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3427
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3428
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3429
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3430
    "Modified: / 2.2.1998 / 23:43:59 / stefan"
1254
38b8bcfabbd7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1253
diff changeset
  3431
    "Modified: / 15.3.1999 / 12:01:38 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3432
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3433
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3434
grabPointerWithCursor:aCursorOrNil
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3435
    "grap the pointer; keep previous grab
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3436
    "
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3437
    previousPointerGrab := device activePointerGrab.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3438
    hasImplicitGrap := true.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3439
  ^ super grabPointerWithCursor:aCursorOrNil
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3440
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3441
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3442
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3443
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3444
ungrabKeyboard
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3445
    "ungrap the keyboard; restore previous grab
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3446
    "
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3447
    super ungrabKeyboard.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3448
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3449
    previousKeyboardGrab notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3450
	device grabKeyboardInView:previousKeyboardGrab.
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3451
    ].
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3452
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3453
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3454
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3455
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3456
ungrabMouseAndKeyboard
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3457
    "ungrab resources (mouse and keyboard)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3458
    "
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3459
    self ungrabPointer.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3460
    self ungrabKeyboard.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3461
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3462
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3463
ungrabPointer
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3464
    "ungrap the pointer; restore previous grab
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3465
    "
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3466
    super ungrabPointer.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3467
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3468
    previousPointerGrab notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3469
	device grabPointerInView:previousPointerGrab.
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3470
    ].
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3471
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3472
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3473
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3474
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  3475
!MenuPanel methodsFor:'help'!
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  3476
2058
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3477
flyByHelpTextAt:srcPoint
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3478
    "return the helpText for aPoint (i.e. when mouse-pointer is moved over an item).
2063
8bff9e49f1e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2062
diff changeset
  3479
     If there is a selection, that items helpText is used (ignoring the given point).
2058
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3480
     "
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3481
    |dstMenu dstPoint|
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3482
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3483
    dstMenu := self detectMenuAtGrabPoint:srcPoint.
2063
8bff9e49f1e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2062
diff changeset
  3484
    dstMenu isNil ifTrue:[^ nil].
2058
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3485
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3486
    dstPoint := dstMenu translateGrabPoint:srcPoint.
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3487
    ^ dstMenu flyByHelpTextForItem:(dstMenu itemAtPoint:dstPoint).
2058
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3488
!
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3489
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3490
flyByHelpTextForItem:anItem
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3491
    "returns the helpText for an item (empty if none)
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3492
    "
2063
8bff9e49f1e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2062
diff changeset
  3493
    anItem isNil ifTrue:[^ nil].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  3494
    ^ anItem flyByHelpText.
2058
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3495
!
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3496
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  3497
helpText
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3498
    "return the helpText for the currently selected item (empty if none)
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3499
    "
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3500
    ^ self helpTextForItem:selection
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  3501
!
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  3502
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3503
helpTextAt:srcPoint
1252
6db6906da49b debug print
Claus Gittinger <cg@exept.de>
parents: 1251
diff changeset
  3504
    "return the helpText for aPoint (i.e. when mouse-pointer is moved over an item).
6db6906da49b debug print
Claus Gittinger <cg@exept.de>
parents: 1251
diff changeset
  3505
     If there is a selection, that items helpText is used (ignoreing the given point).
6db6906da49b debug print
Claus Gittinger <cg@exept.de>
parents: 1251
diff changeset
  3506
     "
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3507
    |dstMenu dstPoint|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3508
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3509
    dstMenu := self detectMenuAtGrabPoint:srcPoint.
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  3510
    dstMenu isNil ifTrue:[^ ''].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3511
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3512
    dstPoint := dstMenu translateGrabPoint:srcPoint.
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3513
    ^ dstMenu helpTextForItem:(dstMenu itemAtPoint:dstPoint).
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3514
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3515
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3516
helpTextForItem:anItem
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3517
    "returns the helpText for an item (empty if none)
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3518
    "
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3519
    anItem isNil ifTrue:[^ ''].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  3520
    ^ anItem activeHelpText.
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  3521
! !
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  3522
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3523
!MenuPanel methodsFor:'image registration'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3524
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  3525
imageOnMyDevice:anImage
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3526
    "returns image registered on device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3527
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3528
    ^ self class image:anImage onDevice:device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3529
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3530
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3531
lightenedImageOnDevice:anImage
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3532
    "returns lightened image registered on device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3533
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3534
    ^ self class lightenedImage:anImage onDevice:device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3535
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3536
1688
271829d6a2e4 category changes
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  3537
!MenuPanel methodsFor:'initialization & release'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3538
767
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  3539
addToCurrentProject
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  3540
    "ignored here"
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  3541
!
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  3542
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3543
create
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3544
    "create the shadow view for a none contained submenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3545
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3546
    super create.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3547
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3548
    self isPopUpView ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3549
	(PopUpView shadowsOnDevice:device) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3550
	    shadowView isNil ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3551
		shadowView := (ShadowView onDevice:device) for:self
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3552
	    ] ifFalse:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3553
		self saveUnder:true.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3554
	    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3555
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3556
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3557
	explicitExtent == true ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3558
	    (self width) == (superView width) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3559
		self verticalLayout:false
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3560
	    ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3561
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3562
    ]
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  3563
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  3564
    "Modified: / 28.7.1998 / 02:11:44 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3565
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3566
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3567
destroy
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3568
    "destroy items and shadowView; remove dependencies
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3569
    "
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3570
    self clearLastActiveMenu.
2051
d958c12cc08e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  3571
    items notNil ifTrue:[items copy do:[:el|el destroy]].
2050
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
  3572
    items     := nil.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3573
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3574
    menuHolder    notNil ifTrue:[menuHolder    removeDependent:self].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3575
    enableChannel notNil ifTrue:[enableChannel removeDependent:self].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3576
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3577
    super destroy.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3578
    superMenu := nil.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3579
    shadowView notNil ifTrue:[shadowView destroy].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3580
2051
d958c12cc08e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  3581
    "Modified: / 15.11.2001 / 17:08:45 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3582
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3583
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3584
fetchDeviceResources
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3585
    "fetch device colors, to avoid reallocation at redraw time
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3586
    "
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3587
    |style|
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3588
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3589
    superMenu notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3590
        styleSheet := superMenu styleSheet
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3591
    ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3592
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3593
    super fetchDeviceResources.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3594
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  3595
    "/ thats a kludge - will be replaced by values from the styleSheet ...
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  3596
    "/ (i.e. read menu.buttonActiveLevel & menu.buttonPassiveLevel)
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  3597
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3598
    superMenu isNil ifTrue:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3599
        rightArrow isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3600
            rightArrow := SelectionInListView rightArrowFormOn:device.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  3601
        ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3602
        fgColor := fgColor onDevice:device.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3603
        style   := styleSheet name.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3604
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3605
        (style ~~ #os2 and:[style ~~ #win95]) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3606
            rightArrowShadow := SelectionInListView rightArrowShadowFormOn:device
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3607
        ] ifFalse:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3608
            rightArrowShadow := nil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3609
        ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3610
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3611
        rightArrow       := superMenu rightArrow.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3612
        rightArrowShadow := superMenu rightArrowShadow.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3613
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3614
        self foregroundColor:(superMenu foregroundColor).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3615
        self            font:(superMenu font).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3616
        self  viewBackground:(superMenu viewBackground).
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  3617
    ].
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  3618
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  3619
    items notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3620
        items do:[:eachItem| eachItem fetchDeviceResources ]
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  3621
    ].
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  3622
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  3623
    "Modified: / 15.9.1998 / 12:51:29 / cg"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3624
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3625
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3626
initStyle
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3627
    "initialize style specific stuff"
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3628
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3629
    super initStyle.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3630
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
  3631
    fgColor        := styleSheet colorAt:#'pullDownMenu.foregroundColor' default:Color black.
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
  3632
    viewBackground := styleSheet colorAt:#'pullDownMenu.backgroundColor' default:viewBackground.
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
  3633
    font           := styleSheet  fontAt:#'menu.font' default:font.
1923
530426a3d692 support #level:
ca
parents: 1922
diff changeset
  3634
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3635
    defaultHideOnRelease := styleSheet at:#'popup.hideOnRelease' default:true.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3636
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3637
    self updateLevelAndBorder.
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3638
!
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3639
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3640
initialize
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3641
    "set default configuration
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3642
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3643
    super initialize.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3644
1730
4936edfc2eee must enable motion events in #initialize (not in map)
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3645
    self enableMotionEvents.
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3646
    enabled := true.
1877
3b415fa4710f only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents: 1874
diff changeset
  3647
    self extentChangedFlag:false.
3b415fa4710f only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents: 1874
diff changeset
  3648
    self originChangedFlag:false.
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3649
    explicitExtent      := nil.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3650
    shortKeyInset       := 0.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3651
    mustRearrange       := false.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3652
    showSeparatingLines := false.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3653
    showGroupDivider    := true.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3654
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3655
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  3656
map
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3657
    "grab the pointer here, when visible (but not if control has already been lost). 
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3658
     If the grab fails, try again and unmap myself if that fails too.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3659
    "
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3660
    |loIndices loItems|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3661
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3662
    enteredItem := nil.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3663
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  3664
    self enableMotionEvents.
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3665
    self becomesActiveMenu.
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  3666
    super map.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3667
1785
efa4cc8ca917 mnemonic behaviour changed
ca
parents: 1775
diff changeset
  3668
    loIndices := InitialSelectionQuerySignal query.
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3669
    loItems   := items ? #[].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3670
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3671
    loItems do:[:anItem| anItem fetchImages ].
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3672
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3673
    self isPopUpView ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3674
	self doGrab
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3675
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3676
	super viewBackground:(self backgroundColor).
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3677
    ].
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3678
    loItems do:[:el| el updateIndicators ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3679
1785
efa4cc8ca917 mnemonic behaviour changed
ca
parents: 1775
diff changeset
  3680
    loIndices size > 0 ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3681
	self redrawX:0 y:0 width:width height:height.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3682
	self openMenusFromItemIndices:loIndices.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3683
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3684
1177
cfd7f71639f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1164
diff changeset
  3685
    "Modified: / 19.11.1998 / 12:59:00 / cg"
1257
79a40d3f8c2f Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents: 1255
diff changeset
  3686
    "Modified: / 18.3.1999 / 18:22:18 / stefan"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3687
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3688
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3689
realize
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3690
    "realize menu and shadowView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3691
    "
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3692
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3693
    self isPopUpView ifTrue:[
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3694
        "Because of #saveUnder of ShadowView the order of realize is significant:
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3695
         shadowView must be realized before self"
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3696
        self hiddenOnRealize:true.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3697
        super realize.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3698
        self resize.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3699
        self makeFullyVisible.
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3700
"/        self mustRearrange.
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3701
        shadowView notNil ifTrue:[
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3702
            shadowView realize.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3703
        ].
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3704
        self raise.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3705
        self map.
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3706
    ] ifFalse:[
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3707
        super realize.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3708
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3709
    self allSubViewsDo:[:aView| aView realize ].
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3710
    hideOnRelease := defaultHideOnRelease.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3711
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3712
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3713
recreate
1832
f6e6640e99a3 comment
Claus Gittinger <cg@exept.de>
parents: 1829
diff changeset
  3714
    "this is called after a snapin or a migration.
f6e6640e99a3 comment
Claus Gittinger <cg@exept.de>
parents: 1829
diff changeset
  3715
     If the image was saved with an active menu, hide the menu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3716
    "
1455
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  3717
    selection := nil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3718
    super recreate.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3719
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3720
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3721
reinitStyle
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3722
    "handle style change while being open (win32 only - for now)"
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3723
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3724
    super reinitStyle.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3725
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3726
    self fetchDeviceResources.
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  3727
    self mustRearrange.      "/ care for changed font sizes etc.
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  3728
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  3729
    self do:[:anItem |
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  3730
        anItem reinitStyle
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  3731
    ].
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3732
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3733
    "Created: / 10.9.1998 / 21:37:05 / cg"
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  3734
    "Modified: / 17.8.2000 / 18:01:33 / cg"
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3735
!
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3736
1796
c9d801c011f7 recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  3737
reinitialize
c9d801c011f7 recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  3738
    "reinit after a snapIn
c9d801c011f7 recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  3739
    "
c9d801c011f7 recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  3740
c9d801c011f7 recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  3741
    super reinitialize.
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  3742
"/    self reinitStyle.
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  3743
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  3744
    "Modified: / 17.8.2000 / 17:53:31 / cg"
1796
c9d801c011f7 recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  3745
!
c9d801c011f7 recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  3746
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3747
unmap
1330
63d2fe5ebd48 comment
Claus Gittinger <cg@exept.de>
parents: 1313
diff changeset
  3748
    "unmap the view - the view stays created (but invisible), and can be remapped again later.
63d2fe5ebd48 comment
Claus Gittinger <cg@exept.de>
parents: 1313
diff changeset
  3749
     If we have a popup supermenu, it will get all keyboard and mouse events."
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3750
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3751
    self clearLastActiveMenu.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3752
    self doUngrab:(superMenu isNil).
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3753
"/    self isPopUpView ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3754
"/         self doUngrab:(superMenu isNil)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3755
"/    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3756
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3757
    super unmap.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3758
    shadowView notNil ifTrue:[shadowView unmap].
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3759
!
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3760
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3761
updateLevelAndBorder
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3762
    "update level & border, when it is known if I am a popUpView"
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3763
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3764
    |bw lvl|
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3765
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3766
    self isPopUpView ifTrue:[
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3767
        bw  := styleSheet at:#'popup.borderWidth' default:1.
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3768
        lvl := styleSheet at:#'popup.level'       default:0.
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3769
    ] ifFalse:[
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3770
        bw  := styleSheet is3D ifFalse:[1] ifTrue:[0].
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
  3771
        lvl := styleSheet at:#'pullDownMenu.level' default:1.
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3772
    ].
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3773
    self borderWidth:bw.
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3774
    self level:lvl.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3775
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3776
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3777
!MenuPanel methodsFor:'keyboard control'!
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3778
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3779
mnemonicViewNext:aKeyEvent
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3780
    "a  mnemonicKey event as forwarded from the keyboardProcessor - if there
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3781
     is the mnemonic-key defined for any menuItem, handle the menuItem and
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3782
     return the topMenu otherwise nil.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3783
    "
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3784
    |menu uKey lKey list index|
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3785
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3786
    superMenu notNil ifTrue:[ ^ superMenu mnemonicViewNext:aKeyEvent ].
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3787
    shown ifFalse:[^ nil].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3788
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3789
    uKey := aKeyEvent rawKey last asUppercase.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3790
    lKey := uKey asLowercase.
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3791
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3792
    selection notNil ifTrue:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3793
        "first lookup the current grapMenu before starting in the topMenu
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3794
        "
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3795
        menu := self detectGrabMenu.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3796
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3797
        [ menu ~~ self ] whileTrue:[
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3798
            index := menu selectionIndex.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3799
            list  := menu selectItemIndicesFor:[:el||k| k := el accessCharacter. k == uKey or:[k == lKey]]
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3800
                                      maxDepth:10 from:(index + 1) to:99999.
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3801
        
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3802
            list size ~~ 0 ifTrue:[
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3803
                "/ has item which responds to the mnemonic
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3804
                menu processCollectedIndices:list.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3805
                ^ self
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3806
            ].
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3807
            menu := menu superMenu.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3808
        ].
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3809
        index := self selectionIndex.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3810
        list  := self selectItemIndicesFor:[:el||k| k := el accessCharacter. k == uKey or:[k == lKey] ]
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3811
                                  maxDepth:10 from:(1 + index) to:99999.
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3812
    ] ifFalse:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3813
        index := 99999.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3814
        list  := nil.
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3815
    ].    
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3816
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3817
    list isNil ifTrue:[
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3818
        list := self selectItemIndicesFor:[:el||k| k := el accessCharacter. k == uKey or:[k == lKey] ]
2481
1416d9b45a37 only walk submenus down 1 level when seacrhing for accelerators
james
parents: 2473
diff changeset
  3819
                                 maxDepth:1 from:1 to:index.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3820
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3821
        list isNil ifTrue:[
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3822
            "/ must clear existing selection
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3823
            self selection:nil.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3824
            ^ nil
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3825
        ]
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3826
    ].
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3827
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3828
    "/ has item which responds to the mnemonic
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3829
    self processCollectedIndices:list.
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3830
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3831
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3832
openMenusFromItemIndices:anItemIndiceList
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3833
    "open all menus derived from sequence of item indices
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3834
    "
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3835
    |item|
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3836
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3837
    anItemIndiceList size == 0 ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3838
        ^ self
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3839
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3840
    item := self itemAt:(anItemIndiceList removeFirst).
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3841
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3842
    (item notNil and:[item enabled]) ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3843
        InitialSelectionQuerySignal answer:anItemIndiceList do:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3844
            self selection:item openMenu:true.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3845
        ]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3846
    ].
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3847
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3848
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3849
processCollectedIndices:indices
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3850
    |menu item|
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3851
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3852
    indices size == 0 ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3853
	^ self
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3854
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3855
    menu := self.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3856
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3857
    [menu selectionIndex == indices first] whileTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3858
	(    (item := menu selection) isNil             "/ shouldn't happen
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3859
	 or:[(menu := item submenu) isNil]              "/ no more indices; done
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3860
	) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3861
	    ^ true
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3862
	].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3863
	indices removeFirst.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3864
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3865
	indices isEmpty ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3866
	   menu selection:nil.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3867
	 ^ self
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3868
	]
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3869
    ].
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3870
    menu openMenusFromItemIndices:indices.
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3871
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3872
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3873
processShortcut:aKeyEvent
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3874
    "a  shortcutKey event as forwarded from the keyboardProcessor - if there is the
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3875
     shortcut-key defined process the shortcut and return true otherwise false.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3876
    "
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3877
    |menu rKey lKey list item|
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3879
    superMenu notNil ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3880
        ^ superMenu processShortcut:aKeyEvent
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3881
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3882
    shown ifFalse:[^ false].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3883
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3884
    item := nil.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3885
    rKey := aKeyEvent rawKey.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3886
    lKey := aKeyEvent key.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3887
    menu := self detectGrabMenu. "/ first lookup the current grapMenu before starting in the topMenu
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3888
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3889
    [true] whileTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3890
        list := menu selectItemIndicesFor:[:el||skey|
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3891
                                                item := el.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3892
                                                skey := el shortcutKey.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3893
                                                skey == rKey or:[skey == lKey]
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3894
                                          ]
2481
1416d9b45a37 only walk submenus down 1 level when seacrhing for accelerators
james
parents: 2473
diff changeset
  3895
                                 maxDepth:1 "10".
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3896
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3897
        list size ~~ 0 ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3898
            "/ has item which responds to the shortcut
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3899
            item hasSubmenu ifFalse:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3900
                menu accept:item
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3901
            ] ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3902
                menu processCollectedIndices:list.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3903
                self windowGroup focusView:self.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3904
            ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3905
          ^ true
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3906
        ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3907
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3908
        menu == self ifTrue:[ ^ false ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3909
        menu := self.
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3910
    ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3911
    ^ false     "/ never reached
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3912
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3913
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3914
selectItemIndicesFor:aOneArgBlock maxDepth:maxDepth
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3915
    "returns the sequence of indices up to the item for which the block
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3916
     returns true. The first entry is the topmenu, the last entry the
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3917
     item for which the block returns true.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3918
     If no item is detected, nil is returned
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3919
    "
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3920
    ^ self selectItemIndicesFor:aOneArgBlock maxDepth:maxDepth from:1 to:99999
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3921
!
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3922
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3923
selectItemIndicesFor:aOneArgBlock maxDepth:maxDepth from:aStart to:aStop
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3924
    "returns the sequence of indices up to the item for which the block
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3925
     returns true. The first entry is the topmenu, the last entry the
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3926
     item for which the block returns true.
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3927
     If no item is detected, nil is returned
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3928
    "
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3929
    |start stop|
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3930
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3931
    maxDepth <= 0 ifTrue:[^ nil].
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3932
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3933
    start := aStart max:1.
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3934
    stop  := aStop  min:(items size).
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3935
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  3936
    start to:stop do:[:i| |item menu seq isItem test|
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3937
	item := items at:i.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3938
	test := isItem := aOneArgBlock value:item.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3939
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3940
	test ifFalse:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3941
	    item hasSubmenu ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3942
		test := item hasDelayedMenu not
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3943
	    ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3944
	].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3945
	test ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3946
	    (item enabled and:[item isVisible]) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3947
		isItem ifTrue:[ ^ OrderedCollection with:i ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3948
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3949
		"process submenu"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3950
		menu := item submenu.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3951
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3952
		(menu notNil and:[menu isEnabled]) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3953
		    seq := menu selectItemIndicesFor:aOneArgBlock maxDepth:(maxDepth - 1).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3954
		    seq notNil ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3955
			seq addFirst:i.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3956
		      ^ seq
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3957
		    ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3958
		]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3959
	    ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3960
	].
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3961
    ].
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3962
    ^ nil
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3963
! !
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3964
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3965
!MenuPanel methodsFor:'misc'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3966
427
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  3967
raiseDeiconified
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  3968
    ^ self raise
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  3969
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  3970
    "Created: 21.6.1997 / 13:29:12 / cg"
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  3971
!
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  3972
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3973
superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3974
    "returns supermenu or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3975
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3976
    ^ superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3977
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3978
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3979
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3980
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3981
topMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3982
    "returns the topMenu; the one having no superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3983
    "
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3984
    |menu smenu|
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3985
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3986
    menu := self.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3987
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3988
    [(smenu := menu superMenu) notNil] whileTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3989
	menu := smenu
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3990
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3991
    ^ menu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3992
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3993
1825
962390f1b499 category change
Claus Gittinger <cg@exept.de>
parents: 1824
diff changeset
  3994
!MenuPanel methodsFor:'printing & storing'!
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3995
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3996
printString
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3997
    "return a printed representation of the menu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3998
    "
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3999
    |string label|
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4000
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4001
    string := 'Menu:'.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4002
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4003
    self do:[:anItem|
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  4004
	label  := anItem label ? ''.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  4005
	string := string ,' ', label printString.
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4006
    ].
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4007
    ^ string
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4008
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4009
    "Modified: / 27.2.1998 / 17:41:22 / cg"
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4010
! !
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4011
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4012
!MenuPanel methodsFor:'private'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4013
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  4014
application
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4015
    "optimize access to retrive the application
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4016
    "
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4017
    application notNil ifTrue:[^ application ].
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  4018
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  4019
    superMenu notNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4020
        application := superMenu application.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4021
        ^ application
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4022
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4023
    application := super application.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4024
    ^ application
1872
b20e27632fd8 application fetch fix
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  4025
!
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  4026
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4027
detectItemForKey:aKey
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4028
    "returns the item assigned to a key, accessCharacter or starts with.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4029
     if no item is detected nil is returned.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4030
    "
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4031
    |cIdx uKey lKey item|
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4032
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4033
    items isNil ifTrue:[^ nil].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4034
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4035
    cIdx := self selectionIndex.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4036
    uKey := aKey asUppercase.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4037
    lKey := aKey asLowercase.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4038
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4039
    items keysAndValuesDo:[:anIndex :anItem| |char label|
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4040
	(     anIndex ~~ cIdx
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4041
	 and:[anItem canSelect
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4042
	 and:[(label := anItem textLabel) notNil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4043
	 and:[label size ~~ 0]]]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4044
	) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4045
	    (char := anItem accessCharacter) notNil ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4046
		(char == uKey or:[char == lKey]) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4047
		    ^ anItem
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4048
		]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4049
	    ] ifFalse:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4050
		char := label at:1.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4051
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4052
		(char == uKey or:[char == lKey]) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4053
		    anIndex > cIdx ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4054
			^ anItem
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4055
		    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4056
		    item isNil ifTrue:[item := anItem]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4057
		]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4058
	    ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4059
	]
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4060
    ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4061
    ^ item
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4062
!
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4063
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4064
menuAdornmentAt:aSymbol
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4065
    "returns a value derived from adornment
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4066
    "
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4067
    adornment isNil ifTrue:[^ nil].
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4068
    ^ adornment at:aSymbol ifAbsent:nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4069
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4070
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4071
menuAdornmentAt:aSymbol put:something
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4072
    "sets a value for the specific menu
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4073
    "
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4074
    |oldValue|
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4075
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  4076
    adornment isNil ifTrue:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4077
        something isNil ifTrue:[^ self].
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4078
        adornment := IdentityDictionary new.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4079
    ] ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4080
        oldValue := adornment at:aSymbol ifAbsent:nil.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4081
        oldValue == something ifTrue:[^ self].
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  4082
    ].
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  4083
    adornment at:aSymbol put:something.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4084
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4085
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4086
onEachPerform:aSelector withArgList:aList
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4087
    "on each item perform selector with an argument derived from aList
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4088
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4089
    aList isCollection ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  4090
	items size >= aList size ifTrue:[
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  4091
	    aList keysAndValuesDo:[:anIndex :anArg|
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  4092
		(items at:anIndex) perform:aSelector with:anArg
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  4093
	    ]
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  4094
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4095
    ] ifFalse:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  4096
	self do:[:anItem| anItem perform:aSelector with:aList ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4097
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4098
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4099
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4100
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4101
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4102
registerImageOnDevice:anImage
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4103
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4104
    anImage isNil ifTrue:[ ^ nil ].
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4105
  ^ self class image:anImage onDevice:device
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4106
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4107
"/    |image|
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4108
"/
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4109
"/    (image := anImage) notNil ifTrue:[
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4110
"/        image device ~~ device ifTrue:[
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4111
"/            image := image copy.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4112
"/        ].
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4113
"/        image := image onDevice:device.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4114
"/        image := image clearMaskedPixels.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4115
"/    ].
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4116
"/    ^ image
2355
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4117
!
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4118
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4119
superMenu:aSuperMenu
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4120
    "set my supermenu from which i'am activated
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4121
    "
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4122
    superMenu := aSuperMenu.
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4123
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4124
    superMenu notNil ifTrue:[
2355
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4125
        styleSheet       := superMenu styleSheet.
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4126
        rightArrow       := superMenu rightArrow.
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4127
        rightArrowShadow := superMenu rightArrowShadow.
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4128
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4129
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4130
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4131
!MenuPanel methodsFor:'private-activation'!
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4132
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4133
activeMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4134
    "returns the current active menu or self (the top menu)
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4135
    "
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4136
    ^ lastActiveMenu ? self
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4137
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4138
    "Created: / 27.2.1998 / 17:41:15 / cg"
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4139
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4140
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4141
activeMenu:aMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4142
    "set the current active menu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4143
    "
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4144
    lastActiveMenu := aMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4145
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4146
    "Created: / 27.2.1998 / 17:41:16 / cg"
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4147
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4148
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4149
becomesActiveMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4150
    "submenu becomes the active menu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4151
    "
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4152
    mapTime := Time millisecondClockValue.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4153
    self topMenu activeMenu:self.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4154
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4155
    "Created: / 27.2.1998 / 17:41:23 / cg"
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4156
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4157
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4158
clearLastActiveMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4159
    "reset the current active menu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4160
    "
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4161
    |top|
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4162
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4163
    top := self topMenu.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4164
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4165
"/    prevFocusView notNil ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4166
"/        self windowGroup focusView:prevFocusView.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4167
"/        prevFocusView := nil.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4168
"/    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4169
"/
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4170
    top activeMenu == self ifTrue:[
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4171
        top activeMenu:nil
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4172
    ]
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4173
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4174
    "Created: / 27.2.1998 / 17:41:17 / cg"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4175
!
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4176
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4177
mapTime
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4178
    "returns the time when the menu becomes active
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4179
    "
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4180
    ^ mapTime
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4181
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4182
    "Modified: / 27.2.1998 / 17:41:18 / cg"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4183
! !
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4184
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4185
!MenuPanel methodsFor:'private-scrolling'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4186
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4187
hasScrollerAt:aDirection
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4188
    "returns true if a visible scroller at a direction exists
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4189
    "
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4190
    |layout|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4191
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4192
    self hasScrollers ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4193
	^ false
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4194
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4195
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4196
    aDirection == #PREV ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4197
	layout := items first layout.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4198
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4199
      ^ self verticalLayout ifTrue:[ layout top  < margin]
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4200
			   ifFalse:[ layout left < margin]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4201
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4202
    layout := items last layout.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4203
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4204
  ^ self verticalLayout ifTrue:[ layout bottom > (height - margin)]
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4205
		       ifFalse:[ layout right  > (width  - margin)]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4206
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4207
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4208
hasScrollers
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4209
    "returns true if scrollers are needed
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4210
    "
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4211
    |maxExtent first last isVert|
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4212
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4213
    (mustRearrange or:[items size < 2]) ifTrue:[^ false].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4214
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4215
    isVert := self verticalLayout.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4216
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4217
    superView notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4218
	(    (first := items first layout) isNil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4219
	 or:[(last  := items last  layout) isNil]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4220
	) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4221
	    ^ false
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4222
	].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4223
	isVert ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4224
	    ^ first top < 0 or:[last bottom > height]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4225
	].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4226
	^ first left < 0 or:[last right > width]
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4227
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4228
    maxExtent := self maxExtent.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4229
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4230
    isVert ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4231
	^ (height < maxExtent y) not
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4232
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4233
    ^ (width < maxExtent x) not
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4234
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4235
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4236
indexOfItemAtScroller:aDirection
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4237
    "returns the index of the item under the scroller or 0
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4238
    "
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4239
    |bounds min max layout|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4240
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4241
    bounds := self scrollerBoundsAt:aDirection.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4242
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4243
    bounds isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4244
	^ 0
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4245
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4246
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4247
    self verticalLayout ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4248
	min := bounds top.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4249
	max := bounds bottom.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4250
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4251
	items keysAndValuesDo:[:anIndex :anItem|
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4252
	    anItem isVisible ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4253
		layout := anItem layout.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4254
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4255
		(layout top < max and:[layout bottom > min]) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4256
		    ^ anIndex
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4257
		].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4258
	    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4259
	].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4260
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4261
	min := bounds left.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4262
	max := bounds right.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4263
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4264
	items keysAndValuesDo:[:anIndex :anItem|
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4265
	    anItem isVisible ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4266
		layout := anItem layout.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4267
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4268
		(layout left < max and:[layout right > min]) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4269
		    ^ anIndex
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4270
		].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4271
	    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4272
	]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4273
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4274
    ^ 0
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4275
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4276
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4277
makeItemVisible:anItem
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4278
    "make an item visible
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4279
    "
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4280
    |boundsPREV boundsNEXT delta layout index scr0 scr1 windowSz scrSz doScroll
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4281
     isVertical boundsMin layoutMin boundsMax layoutMax dltOrg
2042
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  4282
     inv1 inv2|
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4283
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4284
    (     anItem notNil
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4285
     and:[self hasScrollers
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4286
     and:[(layout := anItem layout) notNil]]
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4287
    ) ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4288
	^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4289
    ].
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4290
    index      := self indexOfItem:anItem.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4291
    boundsPREV := self scrollerBoundsAt:#PREV.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4292
    boundsNEXT := self scrollerBoundsAt:#NEXT.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4293
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4294
    isVertical := self verticalLayout.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4295
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4296
    isVertical ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4297
	boundsMin := boundsPREV bottom.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4298
	boundsMax := boundsNEXT top.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4299
	layoutMin := layout top.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4300
	layoutMax := layout bottom.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4301
	windowSz  := height.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4302
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4303
	boundsMin := boundsPREV right.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4304
	boundsMax := boundsNEXT left.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4305
	layoutMin := layout left.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4306
	layoutMax := layout right.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4307
	windowSz  := width.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4308
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4309
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4310
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4311
    layoutMin < boundsMin ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4312
	layoutMin >= 0 ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4313
	    ^ self
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4314
	].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4315
	"/ test whether is first visible item
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4316
	index := items findLast:[:el| el isVisible] startingAt:(index - 1).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4317
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4318
	index == 0 ifTrue:[ scr0 := margin ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4319
		  ifFalse:[ scr0 := boundsMin ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4320
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4321
	delta := layoutMin negated + scr0.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4322
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4323
	layoutMax > boundsMax ifFalse:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4324
	    ^ self
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4325
	].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4326
	"/ test whether is last visible item
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4327
	index  := items findFirst:[:el| el isVisible ] startingAt:(index + 1).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4328
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4329
	index == 0 ifTrue:[ scr0 := windowSz - margin ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4330
		  ifFalse:[ scr0 := boundsMax ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4331
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4332
	delta := scr0 - layoutMax.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4333
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4334
    delta == 0 ifTrue:[ ^ self ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4335
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4336
    doScroll := false.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4337
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4338
    shown ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4339
	delta abs < (windowSz / 2) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4340
	    doScroll := true.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4341
	    self repairDamage
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4342
	]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4343
    ].
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4344
    isVertical ifTrue:[ dltOrg := 0@delta ] ifFalse:[dltOrg := delta@0].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4345
    items do:[:el| el moveBy:dltOrg ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4346
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4347
    doScroll ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4348
	^ self invalidate
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4349
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4350
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4351
    windowSz  := windowSz - margin - margin.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4352
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4353
    scr0  := boundsMin.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4354
    scr1  := scr0 + delta abs.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4355
    scrSz := boundsMax - scr1.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4356
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4357
    delta < 0 ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4358
	isVertical ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4359
	    self copyFrom:self x:margin y:scr1 toX:margin y:scr0
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4360
			   width:windowSz height:scrSz async:false.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4361
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4362
	    scr1 := scr0 + scrSz.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4363
	    inv2 := (margin @ scr1) extent:(windowSz @ (height - scr1 - margin)).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4364
	    "/ self invalidateX:margin y:scr1 width:windowSz height:(height - scr1 - margin).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4365
	] ifFalse:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4366
	    self copyFrom:self x:scr1 y:margin toX:scr0 y:margin
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4367
			   width:scrSz height:windowSz async:false.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4368
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4369
	    scr1 := scr0 + scrSz.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4370
	    inv2 := (scr1 @ margin) extent:((width - scr1 - margin) @ windowSz).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4371
	    "/ self invalidateX:scr1 y:margin width:(width - scr1 - margin) height:windowSz.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4372
	].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4373
	inv1 := boundsPREV.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4374
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4375
	isVertical ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4376
	    self copyFrom:self x:margin y:scr0 toX:margin y:scr1
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4377
			   width:windowSz height:scrSz async:false.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4378
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4379
	    inv2 := (margin @ margin) extent:(windowSz @ (scr1 - margin)).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4380
	    "/ self invalidateX:margin y:margin width:windowSz height:scr1 - margin.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4381
	] ifFalse:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4382
	    self copyFrom:self x:scr0 y:margin toX:scr1 y:margin
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4383
			   width:scrSz height:windowSz async:false.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4384
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4385
	    inv2 := (margin @ margin) extent:(scr1 - margin) @ windowSz.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4386
	    "/ self invalidateX:margin y:margin width:scr1 - margin height:windowSz.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4387
	].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4388
	inv1 := boundsNEXT.
2042
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  4389
    ].
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  4390
    self invalidate:inv1.
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  4391
    self invalidate:inv2.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  4392
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  4393
    "Modified: / 13.11.2001 / 20:26:42 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4394
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4395
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4396
scrollActivity
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4397
    "returns the one and only scrollActivity - data holder
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4398
     for a menu and all contained submenus
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4399
    "
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4400
    superMenu notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4401
	^ superMenu scrollActivity
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4402
    ].
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4403
    scrollActivity isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4404
	scrollActivity := ScrollActivity new.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4405
    ].
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4406
    ^ scrollActivity
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4407
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4408
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4409
scrollerBoundsAt:aDirection
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4410
    "returns the bounds of the scroller at a direction or nil
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4411
    "
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4412
    |y x w h inset|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4413
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4414
    self hasScrollers ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4415
	^ nil
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4416
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4417
    inset := 0.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4418
    x := y := inset.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4419
    w := h := 15.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4420
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4421
    self verticalLayout ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4422
	aDirection == #NEXT ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4423
	    y := height - h - inset.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4424
	].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4425
	w := width - inset - inset.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4426
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4427
	aDirection == #NEXT ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4428
	    x := width - w - inset.       
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4429
	].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4430
	h := height - inset - inset.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4431
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4432
    ^ Rectangle left:x top:y width:w height:h
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4433
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4434
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  4435
scrollerDirectionAtPoint:aPoint
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  4436
    "returns the scroller-direction at aPoint, or nil
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  4437
    "
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  4438
    self hasScrollers ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4439
	#( PREV NEXT ) do:[:aDirection| |bounds|
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4440
	    (    (bounds := self scrollerBoundsAt:aDirection) notNil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4441
	     and:[bounds containsPoint:aPoint]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4442
	    ) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4443
		^ (self hasScrollerAt:aDirection) ifTrue:[aDirection] ifFalse:[nil]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4444
	    ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4445
	]
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  4446
    ].
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  4447
    ^ nil
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  4448
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  4449
    "Created: / 13.11.2001 / 14:13:16 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4450
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4451
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4452
!MenuPanel methodsFor:'private-searching'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4453
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4454
detectGrabMenu
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4455
    "returns the menu which is responsible for the grap; the last opened menu
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4456
    "
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4457
    |subMenu|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4458
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4459
    selection notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4460
	(subMenu := selection visibleSubmenu) notNil ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4461
	    ^ subMenu detectGrabMenu
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4462
	]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4463
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4464
    ^ self
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4465
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4466
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4467
detectMenuAtGrabPoint:aGrabPoint
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4468
    "returns the menu which contains the grab-point
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4469
    "
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4470
    |dstMenu dstPoint firstMenu|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4471
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4472
    dstPoint := self translateGrabPoint:aGrabPoint.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4473
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4474
    ((dstPoint x between:0 and:width) and:[dstPoint y between:0 and:height]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4475
	firstMenu := self.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4476
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4477
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4478
    (selection isNil or:[(dstMenu := selection visibleSubmenu) isNil]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4479
	^ firstMenu
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4480
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4481
    dstMenu := dstMenu detectMenuAtGrabPoint:aGrabPoint.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  4482
    ^ dstMenu ? firstMenu
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4483
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4484
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4485
detectViewAtX:x y:y in:aTopView
1922
1a2ab52eb2ab bug fix in #detectViewAtX:y:in:
ca
parents: 1921
diff changeset
  4486
    "detect view at x@y
1a2ab52eb2ab bug fix in #detectViewAtX:y:in:
ca
parents: 1921
diff changeset
  4487
    "
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4488
    ^ aTopView detectViewAt:(x@y).
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4489
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4490
"/ cg: old code was (refactored to use common code)
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4491
"/
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4492
"/    |p subViews|
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4493
"/
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4494
"/    (subViews := aTopView subViews) notNil ifTrue:[
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4495
"/        subViews do:[:v| |p|
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4496
"/            v shown ifTrue:[
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4497
"/                (    (x between:(v left) and:(v right))
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4498
"/                 and:[y between:(v top)  and:(v bottom)]
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4499
"/                ) ifTrue:[
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4500
"/                    p := device translatePoint:(x@y) from:(aTopView id) to:(v id).
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4501
"/                  ^ self detectViewAtX:p x y:p y in:v.
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4502
"/                ]
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4503
"/            ]
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4504
"/        ]
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4505
"/    ].
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4506
"/    ^ aTopView
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4507
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4508
    "Modified: / 10.10.2001 / 13:45:56 / cg"
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4509
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4510
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4511
itemAt:stringOrNumberOrPoint
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4512
    "returns item assigned to an index, nameKey, textLabel or value if symbol.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4513
     If no item match nil is returned.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4514
    "
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4515
    |idx|
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4516
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4517
    stringOrNumberOrPoint isPoint ifTrue:[
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4518
        ^ self itemAtPoint:stringOrNumberOrPoint
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4519
    ].
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4520
    idx := self indexOf:stringOrNumberOrPoint.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4521
    (idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ].
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  4522
    ^ nil
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4523
!
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4524
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4525
itemAtPoint:aPoint
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4526
    "returns the item at aPoint or nil if none detected
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4527
    "
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4528
    |x y|
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4529
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4530
    items notNil ifTrue:[
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4531
        x := aPoint x.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4532
        y := aPoint y.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4533
        ^ items detect:[:el| el containsPointX:x y:y] ifNone:nil
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4534
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4535
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4536
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4537
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  4538
superMenuAtPoint:aPoint
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  4539
    "returns the superMenu which contains aPoint, or nil if none detected
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4540
    "
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4541
    |grabPoint superMenu|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4542
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  4543
    (self containsPoint:aPoint) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4544
	^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4545
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4546
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  4547
    grabPoint := aPoint - (self translateGrabPoint:0).
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4548
    superMenu := self.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4549
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4550
    [ (superMenu := superMenu superMenu) notNil ] whileTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4551
	(superMenu containsPoint:(superMenu translateGrabPoint:grabPoint)) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4552
	    ^ superMenu
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4553
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4554
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4555
  ^ nil
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4556
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  4557
    "Created: / 13.11.2001 / 20:22:53 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4558
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4559
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4560
!MenuPanel methodsFor:'queries'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4561
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4562
container:aView
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4563
    super container:aView.
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4564
    aView notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4565
	"/ I am no longer a popUpView
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4566
	self updateLevelAndBorder
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4567
    ].
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4568
!
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4569
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4570
containsPoint:aPoint
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4571
    "returns true if point is contained by the view
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4572
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4573
    ^ self containsPointX:(aPoint x) y:(aPoint y)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4574
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4575
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4576
containsPointX:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4577
    "returns true if point is contained by the view
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4578
    "
708
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  4579
    ^ (x between:0 and:width) and:[y between:0 and:height]
879
837cee20fdcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 878
diff changeset
  4580
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4581
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4582
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4583
hasGroupDividerAt:anIndex
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4584
    "returns true if a divider is defined at an index
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4585
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4586
    |i|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4587
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4588
    groupSizes size ~~ 0 ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4589
	i := 0.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4590
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4591
	groupSizes do:[:t|
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4592
	    (i := i + t) == anIndex ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4593
		^ true
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4594
	    ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4595
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4596
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4597
  ^ false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4598
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4599
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4600
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4601
hasGroupDividers
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4602
    "returns true if any group divider exists
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4603
    "
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4604
  ^ (items size ~~ 0 and:[groupSizes size ~~ 0])
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4605
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4606
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4607
isEnabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4608
    "returns enabled state of menu and items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4609
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4610
    ^ self enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4611
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4612
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4613
isFitPanel
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4614
    "returns true if the panel is the first in the menu hierarchy in must
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4615
     be fit to the extent of its superView;
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4616
     NOT SUPPORTED
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4617
    "
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4618
    ^ false
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4619
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4620
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4621
isPopUpView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4622
    "return true if view is a popup view; without decoration
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4623
     and popUp to top immediately
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4624
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4625
    ^ superView isNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4626
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4627
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4628
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4629
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4630
isVerticalLayout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4631
    "returns true if vertical layout otherwise false( horizontal layout )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4632
    "
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4633
    ^ self verticalLayout
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4634
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4635
416
c05874084d4c implement
ca
parents: 407
diff changeset
  4636
!
c05874084d4c implement
ca
parents: 407
diff changeset
  4637
1793
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  4638
isViewWrapper
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  4639
    ^ items size == 0 and:[subViews size ~~ 0]
1793
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  4640
!
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  4641
416
c05874084d4c implement
ca
parents: 407
diff changeset
  4642
type
428
ca
parents: 427
diff changeset
  4643
    ^ nil.
416
c05874084d4c implement
ca
parents: 407
diff changeset
  4644
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4645
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4646
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4647
!MenuPanel methodsFor:'selection'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4648
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4649
hasSelection
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4650
    "returns true if a selection exists
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4651
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4652
    ^ self selection notNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4653
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4654
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  4655
openDelayed:anItem
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  4656
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4657
    superMenu notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4658
        superMenu openDelayed:anItem.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4659
        ^ self
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4660
    ].
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4661
    openDelayedMenuBlock notNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4662
        Processor removeTimedBlock:openDelayedMenuBlock.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4663
        openDelayedMenuBlock := nil.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4664
    ].
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4665
    anItem isNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4666
        openDelayedMenuBlock := nil.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4667
        ^ self
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4668
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4669
    openDelayedMenuBlock := [
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4670
        openDelayedMenuBlock := nil.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4671
        anItem openDelayedSubmenu
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4672
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4673
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4674
    Processor addTimedBlock:openDelayedMenuBlock afterSeconds:0.5.
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  4675
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  4676
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4677
selection
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4678
    "returns current selected item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4679
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4680
    ^ selection
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4681
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4682
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4683
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4684
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4685
selection:anItemOrNil
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4686
    "change selection to an item or nil
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4687
     if the item has a submenu the first item might be selected (style-sheet)
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4688
    "
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4689
    |openMenu openOnSelect submenu item|
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4690
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4691
    selection == anItemOrNil ifTrue:[^ self].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4692
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4693
    (anItemOrNil isNil or:[anItemOrNil hasSubmenu not]) ifTrue:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4694
        self selection:anItemOrNil openMenu:false.
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4695
        ^ self
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4696
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4697
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4698
    openMenu     := self isPopUpView not.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4699
    openOnSelect := styleSheet at:#'menu.openOnSelect' default:false.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4700
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4701
    openMenu ifFalse:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4702
        openMenu := openOnSelect.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4703
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4704
    self selection:anItemOrNil openMenu:openMenu.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4705
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4706
    openOnSelect ifFalse:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4707
        "/ select first item in submenu
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4708
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4709
        submenu := anItemOrNil currentSubmenu.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4710
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4711
        submenu notNil ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4712
            item := submenu itemAt:1.
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4713
            (item notNil and:[item hasSubmenu not]) ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4714
                submenu selection:item openMenu:false
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4715
            ]
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4716
        ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4717
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4718
!
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4719
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4720
selection:anItemOrNil openMenu:openMenu
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4721
    "change selection to an item or nil
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4722
    "
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4723
    |helpListener oldSelect|
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4724
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4725
    anItemOrNil == selection ifTrue:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4726
        ^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4727
    ].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  4728
    self openDelayed:nil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4729
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4730
    oldSelect := selection.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4731
    selection := nil.
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4732
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4733
    anItemOrNil notNil ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4734
        self makeItemVisible:anItemOrNil.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4735
        anItemOrNil canSelect ifTrue:[
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4736
            selection := anItemOrNil
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4737
        ] ifFalse:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4738
            oldSelect isNil ifTrue:[^ self].
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4739
        ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4740
    ].
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4741
    oldSelect notNil ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4742
        "/ clear current selection
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4743
        oldSelect isSelected:false.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4744
    ].
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4745
    selection isNil ifTrue:[^ self].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4746
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4747
    selection == enteredItem ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4748
        enteredItem := nil
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4749
    ] ifFalse:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4750
        self pointerEntersItem:nil
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4751
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4752
    ActiveHelp isActive ifTrue:[
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4753
        helpListener := ActiveHelp currentHelpListener.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4754
        helpListener initiateHelpFor:self at:nil now:true.
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4755
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4756
    shown ifTrue:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4757
        self rearrangeItems.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4758
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4759
        openMenu ifFalse:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4760
            selection invalidate.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4761
        ]
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4762
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4763
    openMenu ifTrue:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4764
        selection isSelected:true.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4765
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4766
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4767
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4768
selectionIndex
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4769
    "returns index of current selection or 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4770
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4771
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4772
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4773
    (item := self selection) notNil ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  4774
	^ self findFirst:[:el| el == item ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4775
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4776
    ^ 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4777
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4778
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4779
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4780
selectionIndex:anIndex
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4781
    "set selection at an index
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4782
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4783
    self selection:(self itemAt:anIndex)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4784
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4785
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4786
!MenuPanel methodsFor:'translation'!
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4787
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4788
translateGrabPoint:aGrabPoint
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4789
    "translate the grab point into self
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4790
    "
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4791
    superMenu isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4792
	"I am the grapView"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4793
	aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint].
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4794
      ^ aGrabPoint
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4795
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4796
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4797
    relativeGrabOrigin isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4798
	relativeGrabOrigin := self topMenu translatePoint:0 to:self.
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4799
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4800
    ^ relativeGrabOrigin + aGrabPoint
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4801
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4802
!
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4803
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4804
translateMenuPoint:aPoint toMenu:aMenu
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4805
    "translate a point into another menu its point
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4806
    "
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4807
    |grapPoint|
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4808
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4809
    aMenu == self ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4810
	^ aPoint
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4811
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4812
    grapPoint := aPoint - (self translateGrabPoint:0).
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4813
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4814
  ^ aMenu translateGrabPoint:grapPoint
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4815
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4816
!
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4817
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4818
translatePoint:aPoint to:anotherWindowOrNilForScreen
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4819
    "translate a point in my window to anotherWindowOrNilForScreen (or root window if nil)
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4820
    "
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4821
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4822
    ^ device 
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4823
	translatePoint:aPoint asPoint 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4824
	fromView:self 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4825
	toView:anotherWindowOrNilForScreen
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4826
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4827
    "Modified: / 10.10.2001 / 14:11:47 / cg"
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4828
! !
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4829
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4830
!MenuPanel::Item class methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4831
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  4832
horizontalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  4833
    ^ HorizontalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  4834
!
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  4835
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4836
labelRightOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4837
    ^ LabelRightOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4838
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4839
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  4840
verticalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  4841
    ^ VerticalInset
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4842
!
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4843
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4844
verticalPopUpInset
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4845
    ^ VerticalPopUpInset
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4846
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4847
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4848
!MenuPanel::Item class methodsFor:'defaults'!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4849
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4850
halfSeparatorSize
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4851
    "returns size of a space-separator
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4852
    "
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4853
    ^ 5
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4854
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4855
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4856
separatorSize
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4857
    "returns size of a separator
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4858
    "
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4859
    ^ 10
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4860
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4861
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4862
updateStyleCache
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4863
    "setup defaults
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4864
     self updateStyleCache
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4865
    "
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4866
    <resource: #style (#'menuPanel.verticalInset')>
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4867
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4868
    HorizontalInset       := 2.
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4869
    VerticalInset         := MenuPanel styleSheet at:#'menuPanel.verticalInset' default:2.
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4870
    VerticalPopUpInset    := 2.
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4871
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4872
    HorizontalButtonInset := 3.
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4873
    VerticalButtonInset   := 3.
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4874
681
62c7cdaca188 extra default inset values for button behaviour added
tz
parents: 680
diff changeset
  4875
    LabelRightOffset      := 15.
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4876
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4877
1124
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4878
! !
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4879
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4880
!MenuPanel::Item class methodsFor:'instance creation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4881
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4882
in:aSuperMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4883
    ^ self in:aSuperMenu label:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4884
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4885
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4886
in:aSuperMenu label:aLabel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4887
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4888
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4889
    item := self new in:aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4890
    item label:aLabel.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4891
  ^ item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4892
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4893
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4894
in:aSuperMenu menuItem:aMenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4895
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4896
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4897
    item := self in:aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4898
    item menuItem:aMenuItem.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4899
  ^ item.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4900
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4901
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4902
new
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4903
    ^ self basicNew initialize
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4904
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4905
1808
e8628b502a49 methodCategory change
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
  4906
!MenuPanel::Item methodsFor:'accepting'!
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4907
420
ca
parents: 417
diff changeset
  4908
canAccept
ca
parents: 417
diff changeset
  4909
    "returns true if item is acceptable
ca
parents: 417
diff changeset
  4910
    "
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  4911
    self enabled    ifFalse:[ ^ false].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  4912
    self hasSubmenu ifFalse:[ ^ true ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  4913
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  4914
    self hasDelayedMenu ifFalse:[^ false ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  4915
  ^ subMenu isNil or:[subMenu shown not]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4916
!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4917
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4918
toggleIndication
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4919
    "toggle indication or choice
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4920
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4921
    |arg|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4922
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4923
    indication notNil ifTrue:[    
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4924
        arg := self indicationValue not.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4925
        self indicationValue:arg.
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4926
    ] ifFalse:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4927
        choice notNil ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4928
            choice value:(menuItem choiceValue).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4929
            ^ true
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4930
        ]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4931
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4932
    ^ arg
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4933
! !
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4934
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4935
!MenuPanel::Item methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4936
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4937
accessCharacter
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4938
    "returns my accessCharacter or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4939
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4940
    ^ accessCharacter
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4941
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4942
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4943
accessCharacterPosition
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4944
    "get the access character position or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4945
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4946
    ^ menuItem accessCharacterPosition
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4947
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4948
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4949
accessCharacterPosition:anIndex 
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4950
    "set the access character position or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4951
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4952
    menuItem accessCharacterPosition:anIndex.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4953
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4954
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4955
argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4956
    "gets the argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4957
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4958
    ^ menuItem argument
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4959
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4960
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4961
argument:anArgument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4962
    "sets the argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4963
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4964
    menuItem argument:anArgument.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4965
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4966
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  4967
displayLabel
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  4968
    "returns my printable Label
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  4969
    "
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  4970
    ^ displayLabel
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  4971
!
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  4972
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4973
font
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4974
    "returns the user configured font or nil (default menu font)
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4975
    "
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  4976
    |font|
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  4977
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  4978
    menuPanel isNil ifTrue:[^ nil].
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  4979
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  4980
    font := menuItem font.
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  4981
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  4982
    font notNil ifTrue:[
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  4983
        font := font onDevice:(menuPanel device).
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  4984
        menuItem font:font.
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  4985
    ].
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4986
    ^ font
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4987
!
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4988
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4989
font:aFont
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4990
    "returns the user configured font or nil (default menu font)
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4991
    "
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  4992
    menuItem font:aFont.
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4993
!
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4994
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  4995
itemValue
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  4996
    "gets value
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  4997
    "
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  4998
    ^ menuItem itemValue
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  4999
!
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5000
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5001
itemValue:aValue
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5002
    "argument could be a value holder, an action or selector
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5003
    "
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5004
    menuItem itemValue:aValue.
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5005
!
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5006
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5007
label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5008
    "returns the label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5009
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5010
    ^ label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5011
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5012
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5013
label:aLabel
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  5014
    "set a new label; if the label changed, a redraw is performed;
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  5015
     handle characters $& (ST-80 compatibility)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5016
    "
1978
a53447b8cbe2 set label; reange menu if extent changed otherwise redraw only the item
martin
parents: 1955
diff changeset
  5017
    |size char lbl mfont f oldExtent
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5018
     h "{ Class:SmallInteger }"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5019
     w "{ Class:SmallInteger }"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5020
    |
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5021
    oldExtent       := displayLabelExtent.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5022
    displayLabelExtent  := 0@0.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5023
    accessCharacter := disabledDisplayLabel := nil.
1978
a53447b8cbe2 set label; reange menu if extent changed otherwise redraw only the item
martin
parents: 1955
diff changeset
  5024
    label           := aLabel value.
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5025
    displayLabel    := label value ? ''.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5026
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5027
    displayLabel isString ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5028
        "CHECK FOR SEPARATOR"
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5029
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5030
        (menuItem isButton not and:[indication isNil and:[choice isNil]]) ifTrue:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5031
            size := displayLabel size.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5032
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5033
            size == 0 ifTrue:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5034
                displayLabel := nil.                        "blank separator"
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5035
                ^ self
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5036
            ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5037
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5038
            size == 1 ifTrue:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5039
                char := displayLabel first.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5040
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5041
                (char == $- or:[char == $=]) ifTrue:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5042
                    label    := displayLabel.               "line separator"
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5043
                    displayLabel := nil.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5044
                    ^ self
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5045
                ]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5046
            ]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5047
        ]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5048
    ] ifFalse:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5049
        displayLabel isCollection ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5050
            displayLabel := displayLabel asArray.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5051
        ]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5052
    ].
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5053
    mfont := menuPanel setFont:(self font).
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5054
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5055
    displayLabel isArray ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5056
        w := h := 0.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5057
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5058
        displayLabel keysAndValuesDo:[:i :el|
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5059
            el notNil ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5060
                lbl := self updateAccessCharacterFor:el.
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5061
                displayLabel at:i put:lbl.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5062
                w := w max:(lbl widthOn:menuPanel).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5063
                h := h + 1 + (lbl heightOn:menuPanel).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5064
            ] ifFalse:[
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  5065
                h := h + (self spaceBetweenEmptyLines)
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5066
            ]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5067
        ]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5068
    ] ifFalse:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5069
        displayLabel := self updateAccessCharacterFor:displayLabel.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5070
        w := displayLabel  widthOn:menuPanel.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5071
        h := displayLabel heightOn:menuPanel.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5072
    ].
1797
28327a68241b give a few more pixels at the right if the used font is
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
  5073
28327a68241b give a few more pixels at the right if the used font is
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
  5074
    "/ care for italic fonts - give a few more pixels at the end
28327a68241b give a few more pixels at the right if the used font is
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
  5075
    f := mfont ? (menuPanel font).
28327a68241b give a few more pixels at the right if the used font is
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
  5076
    (f notNil and:[f italic]) ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5077
        w := w + 2.
1797
28327a68241b give a few more pixels at the right if the used font is
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
  5078
    ].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5079
    displayLabelExtent := w@h.
1978
a53447b8cbe2 set label; reange menu if extent changed otherwise redraw only the item
martin
parents: 1955
diff changeset
  5080
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5081
    menuPanel setFont:mfont.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5082
    menuPanel shown ifTrue:[ self fetchImages ].
1978
a53447b8cbe2 set label; reange menu if extent changed otherwise redraw only the item
martin
parents: 1955
diff changeset
  5083
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5084
    oldExtent = displayLabelExtent ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5085
        self invalidate
1978
a53447b8cbe2 set label; reange menu if extent changed otherwise redraw only the item
martin
parents: 1955
diff changeset
  5086
    ] ifFalse:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5087
        menuPanel mustRearrange
1978
a53447b8cbe2 set label; reange menu if extent changed otherwise redraw only the item
martin
parents: 1955
diff changeset
  5088
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5089
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5090
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5091
menuPanel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5092
    "returns my menuPanel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5093
    "
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  5094
    ^ menuPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5095
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5096
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5097
nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5098
    "gets the nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5099
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5100
    ^ menuItem nameKey
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5101
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5102
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5103
nameKey:aNameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5104
    "sets the nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5105
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5106
    menuItem nameKey:aNameKey.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5107
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5108
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5109
rawLabel
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5110
    "returns my raw, unprocessed label
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5111
    "
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5112
    ^ menuItem rawLabel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5113
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5114
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5115
shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5116
    "get the key to press to select the submenu from the keyboard or if
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5117
     no submenu exists evaluate the action assigned to the item (accept).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5118
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5119
    ^ menuItem shortcutKey
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5120
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5121
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5122
shortcutKey:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5123
    "set the key to press to select the submenu from the keyboard or if
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5124
     no submenu exists evaluate the action assigned to the item (accept).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5125
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5126
    menuItem shortcutKey ~= aKey ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5127
        menuItem shortcutKey:aKey.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5128
        self invalidate.
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  5129
    ].
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  5130
!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5131
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5132
startGroup
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5133
    "start group #left #right #center ... or nil
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5134
     at the moment only #right is implemented
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5135
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5136
    ^ menuItem startGroup
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5137
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5138
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5139
startGroup:aSymbol
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5140
    "start group #left #right #center ...
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5141
     at the moment only #right is implemented
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5142
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5143
    menuItem startGroup:aSymbol.
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5144
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5145
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5146
submenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5147
    "returns my submenu or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5148
    "
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5149
    subMenu notNil ifTrue:[^ subMenu].
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5150
  ^ self setupSubmenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5151
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5152
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5153
submenu:aSubMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5154
    "set a new submenu; an existing submenu will be destroyed. This might lead
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5155
     to a redraw if 'hasSubmenu' changed
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5156
    "
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5157
    |widget|
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5158
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5159
    aSubMenu isNil ifTrue:[
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5160
        subMenu notNil ifTrue:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5161
            subMenu destroy.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5162
            subMenu := nil.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5163
        ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5164
        ^ self
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5165
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5166
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5167
    (aSubMenu isKindOf:Menu) ifTrue:[
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5168
        subMenu := MenuPanel new.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5169
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5170
        menuPanel notNil ifTrue:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5171
            subMenu receiver:menuPanel receiver.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5172
        ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5173
        subMenu superMenu:menuPanel.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5174
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5175
        menuItem horizontalLayout == true ifTrue:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5176
            subMenu verticalLayout:false
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5177
        ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5178
        subMenu menu:aSubMenu.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5179
    ] ifFalse:[
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5180
        aSubMenu isView ifFalse:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5181
            (aSubMenu isKindOf:ApplicationModel) ifFalse:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5182
                "/ ... mhhhh ....
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5183
                ^ menuItem submenuChannel:aSubMenu
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5184
            ].            
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5185
            widget := SimpleView new.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5186
            widget client:aSubMenu.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5187
        ] ifTrue:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5188
            widget := aSubMenu
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5189
        ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5190
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5191
        (widget isKindOf:MenuPanel) ifTrue:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5192
            subMenu := widget.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5193
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5194
            menuItem horizontalLayout == true ifTrue:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5195
                subMenu verticalLayout:false
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5196
            ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5197
        ] ifFalse:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5198
            subMenu := MenuPanel new.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5199
            subMenu receiver:menuPanel receiver.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5200
            subMenu addSubView:widget.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5201
            subMenu extent:(widget preferredExtent).
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5202
            widget origin:0.0@0.0 corner:1.0@1.0.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5203
        ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5204
        subMenu superMenu:menuPanel.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5205
    ].
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5206
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5207
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5208
textLabel
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5209
    "returns my textLabel or nil.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5210
     Used internally to select items via initial-character, for example."
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5211
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5212
    |txt|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5213
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5214
    displayLabel notNil ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5215
        displayLabel isArray ifFalse:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5216
            ^ displayLabel perform:#string ifNotUnderstood:nil
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5217
        ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5218
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5219
        displayLabel do:[:el|
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5220
            (txt := el perform:#string ifNotUnderstood:nil) notNil ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5221
                ^ txt
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5222
            ]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5223
        ].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5224
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5225
    ^ nil
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5226
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5227
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5228
triggerOnDown
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5229
    "trigger the action if pressed
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5230
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5231
    menuItem triggerOnDown ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5232
        self hasSubmenu ifFalse:[^ true].
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5233
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5234
    ^ false
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5235
!
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5236
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5237
triggerOnDown:aBool
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5238
    "trigger the action if pressed
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5239
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5240
    menuItem triggerOnDown:aBool.
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5241
!
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5242
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5243
value
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5244
    "gets value
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5245
     Left here for ST80 compatibility - value is a bad name
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5246
    "
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5247
    ^ menuItem itemValue
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5248
!
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5249
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5250
value:aValue
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5251
    "could be a value holder, an action or selector
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5252
     Left here for ST80 compatibility - value: is a bad name
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5253
    "
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5254
    menuItem itemValue:aValue.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  5255
!
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  5256
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  5257
value:aValue argument:anArgument
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  5258
    "set the value and an argument
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  5259
    "
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5260
    menuItem itemValue:aValue.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5261
    menuItem  argument:anArgument.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5262
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5263
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  5264
!MenuPanel::Item methodsFor:'accessing-behavior'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5265
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5266
choice
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5267
    "implements a radio group; the field
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5268
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5269
    ^ choice
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5270
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5271
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5272
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5273
choice:something
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5274
    "set choice indication
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5275
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5276
    choice == something ifTrue:[^ self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5277
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5278
    choice isValueModel ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5279
	choice removeDependent:self
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5280
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5281
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5282
    (choice := something) notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5283
	choice isSymbol ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5284
	    (choice := self aspectAt:choice) isNil ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5285
		choice := something
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5286
	    ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5287
	].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5288
	choice isValueModel ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5289
	    choice addDependent:self
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5290
	]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5291
    ].
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5292
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5293
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5294
choiceValue
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5295
    "implements a radio group; the value writen to the choice if selected
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5296
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5297
    ^ menuItem choiceValue
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5298
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5299
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5300
choiceValue:something
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5301
    "implements a radio group; the value writen to the choice if selected
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5302
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5303
    menuItem choiceValue ~= something ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5304
        menuItem choiceValue:something.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5305
        choice notNil ifTrue:[ self invalidate ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5306
    ].
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5307
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5308
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5309
enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5310
    "returns the enabled state
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5311
    "
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5312
    |state|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5313
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5314
    menuPanel enabled ifFalse:[^ false].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5315
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5316
    enableChannel isSymbol ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5317
        state := self aspectAt:enableChannel.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5318
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5319
        state isNil ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5320
            self ifNotInUIBuilderInfoPrintCR:
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5321
                ('MenuPanel::Item [info]: no aspect for ', enableChannel, ' (in ' , label printString , ')').
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5322
            ^ true
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5323
        ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5324
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5325
        state isValueModel ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5326
            enableChannel := state.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5327
            enableChannel addDependent:self.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5328
            state := enableChannel value.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5329
        ] ifFalse:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5330
            state := state value
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5331
        ]
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5332
    ] ifFalse:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5333
        state := enableChannel value
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5334
    ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5335
    ^ state ~~ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5336
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5337
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5338
enabled:something
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5339
    "change the enabled state; if the state changed, a redraw is performed
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5340
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5341
    |oldState newState|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5342
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5343
    enableChannel isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5344
	oldState := true
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5345
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5346
	oldState := enableChannel value.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5347
	enableChannel isValueModel ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5348
	    enableChannel removeDependent:self
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5349
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5350
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5351
    enableChannel := something.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5352
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5353
    enableChannel isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5354
	menuPanel shown ifFalse:[^ self].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5355
	newState := true
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5356
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5357
	enableChannel isValueModel ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5358
	    enableChannel addDependent:self
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5359
	] ifFalse:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5360
	    enableChannel isSymbol ifTrue:[^ self]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5361
	].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5362
	menuPanel shown ifFalse:[^ self].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5363
	newState := enableChannel value.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5364
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5365
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5366
    newState ~~ oldState ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5367
	self invalidate
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  5368
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5369
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5370
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  5371
hideMenuOnActivated
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  5372
    "hide the menu when the item was activated; the default is true
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  5373
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5374
    ^ menuItem hideMenuOnActivated
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  5375
!
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  5376
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  5377
hideMenuOnActivated:aBool
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  5378
   "hide the menu when the item was activated; the default is true
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  5379
   "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5380
   menuItem hideMenuOnActivated:aBool.
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  5381
!
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  5382
2216
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  5383
ifNotInUIBuilderInfoPrintCR:aMessage
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  5384
    "/ q&d hack to suppress info-messages in UIBuilder
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  5385
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  5386
    (menuPanel receiver isNil
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  5387
    and:[ menuPanel application notNil
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  5388
    and:[ menuPanel application askFor:#isUIPainter]])
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  5389
    ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5390
	^ self "/ suppressed
2216
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  5391
    ].
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  5392
    aMessage infoPrintCR
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  5393
!
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  5394
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5395
indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5396
    "get on/off indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5397
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5398
    ^ indication
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5399
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5400
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5401
indication:something
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5402
    "set on/off indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5403
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5404
    indication == something ifTrue:[^ self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5405
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5406
    indication isValueModel ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5407
	indication removeDependent:self
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5408
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5409
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5410
    (indication := something) notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5411
	indication isValueModel ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5412
	    indication addDependent:self
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5413
	] ifFalse:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5414
	    "/ to force an update of the value
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5415
	    self indicationValue
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5416
	]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5417
    ].
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5418
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5419
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5420
keepLinkedMenu
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5421
    "get the keepLinkedMenu flag
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5422
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5423
    ^ menuItem keepLinkedMenu
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5424
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5425
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5426
keepLinkedMenu:aBool
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5427
    "get the keepLinkedMenu flag
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5428
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5429
    menuItem keepLinkedMenu:aBool.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5430
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5431
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  5432
sendToOriginator
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  5433
    "if true, the message is sent to the originating widget;
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  5434
     otherwise (the default), it it sent to the receiver/application."
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  5435
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5436
    ^ menuItem sendToOriginator
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  5437
!
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  5438
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  5439
sendToOriginator:aBoolean
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  5440
    "if true, the message is sent to the originating widget;
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  5441
     otherwise (the default), it it sent to the receiver/application."
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  5442
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5443
    menuItem sendToOriginator:aBoolean.
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  5444
!
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  5445
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5446
submenuChannel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5447
    "get the submenu channel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5448
    "
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5449
    ^ menuItem submenuChannel
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5450
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5451
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5452
submenuChannel:aSelectorOrNil
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5453
    "returns the submenu channel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5454
    "
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5455
    menuItem submenuChannel:aSelectorOrNil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5456
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5457
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  5458
!MenuPanel::Item methodsFor:'accessing-dimension'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5459
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5460
moveBy:aPoint
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5461
    "move layout origin
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5462
    "
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5463
    layout moveBy:aPoint.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5464
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5465
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5466
preferredExtent
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5467
    "compute my preferred extent excluding the shortCutKey and the menu identifier
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5468
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5469
    |isVertical icon wIcon isButton
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5470
     x "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5471
     y "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5472
     s "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5473
    |
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5474
    self isVisible ifFalse:[^ 0@0 ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5475
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5476
    isButton := menuItem isButton.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5477
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5478
    isButton ifTrue:[
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5479
        s := menuPanel maxAbsoluteButtonLevel.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5480
        x := s + HorizontalButtonInset.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5481
        y := s + VerticalButtonInset.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5482
    ] ifFalse:[
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5483
        x  := HorizontalInset.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5484
        y  := (menuPanel isPopUpView ifTrue:[VerticalPopUpInset] ifFalse:[VerticalInset]) ? 2.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5485
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5486
    x := x * 2.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5487
    y := y * 2.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5488
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5489
    isVertical := menuPanel verticalLayout.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5490
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  5491
    self isSeparator ifTrue:[
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5492
        "SEPARATOR"
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5493
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5494
        s := self class separatorSize.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5495
        label = '' ifTrue:[
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5496
            s := self class halfSeparatorSize.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5497
        ].
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5498
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5499
        "width of doubleSeparator is 5 !!!!"
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5500
        isVertical ifFalse:[
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5501
            x := x max:s.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5502
            y := y + 5.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5503
        ] ifTrue:[
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5504
            y := y max:s.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5505
            x := x + 5.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5506
        ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5507
    ] ifFalse:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5508
        x := x + displayLabelExtent x.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5509
        y := y + displayLabelExtent y.
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5510
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5511
        isButton ifFalse:[
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5512
            menuPanel showSeparatingLines ifTrue:[
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5513
                "width of separator is 2 plus right offset 1 := 3"
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5514
                isVertical ifFalse:[x := x + 3] ifTrue:[y := y + 3].
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5515
            ].
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5516
            (indication notNil or:[choice notNil]) ifTrue:[
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5517
                x := x + 2 + menuPanel iconIndicationOff width.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5518
            ].
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5519
        ].
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  5520
        wIcon := 0.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  5521
        self hasMenuIndicator ifTrue:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  5522
            icon := MenuPanel menuIndicator.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  5523
            wIcon := MenuPanel menuIndicatorOffset + icon width.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  5524
        ] ifFalse:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  5525
            self hasDelayedMenuIndicator ifTrue:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  5526
                icon := MenuPanel delayedMenuIndicator.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  5527
                wIcon := MenuPanel delayedMenuIndicatorOffset + icon width.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  5528
            ]
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5529
        ].
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  5530
        x := x + wIcon.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5531
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5532
    ^ x@y
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5533
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5534
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  5535
!MenuPanel::Item methodsFor:'accessing-help'!
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5536
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5537
activeHelpKey
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5538
    "get the active helpKey; the key to retrieve the helpText from the application
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5539
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5540
    ^ menuItem activeHelpKey
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5541
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5542
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5543
activeHelpKey:aHelpKey
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5544
    "set the active helpKey; the key to retrieve the helpText from the application
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5545
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5546
    menuItem activeHelpKey:aHelpKey.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5547
    activeHelpText := nil.
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5548
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5549
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5550
activeHelpText
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5551
    "get the active helpText or nil if not yet resolved
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5552
    "
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5553
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5554
    |app key|
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5555
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5556
    activeHelpText notNil ifTrue:[^ activeHelpText].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5557
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5558
    ((key := self activeHelpKey) notNil 
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5559
    and:[(app := menuPanel application) notNil]) ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5560
        ^ app helpTextForKey:key.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5561
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5562
    ^ nil
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5563
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5564
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5565
activeHelpText:aText
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5566
    "set the active helpText
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5567
    "
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5568
    activeHelpText := aText.
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5569
!
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5570
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5571
flyByHelpText
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5572
    "get the flyBy helpText or nil.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5573
    "
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5574
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5575
    |text key app|
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5576
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5577
    flyByHelpText notNil ifTrue:[^ flyByHelpText].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5578
2471
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  5579
    "/ its NOT the button-attribute, which controls flyByHelp suppression...
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  5580
    "/ (if you have an argument for that let us know..)
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  5581
    "/    self isButton ifFalse:[^ nil].
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  5582
    (menuPanel isNil or:[menuPanel isPopUpView]) ifTrue:[^ nil].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5583
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5584
    key := self activeHelpKey. 
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5585
    (key notNil and:[(app := menuPanel application) notNil]) ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5586
        text := app flyByHelpTextForKey:key.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5587
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5588
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5589
    text isNil ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5590
        text := key.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5591
        text isNil ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5592
            text := self label.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5593
            text isString ifFalse:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5594
                text := menuItem rawLabel.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5595
                text isString ifFalse:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5596
                    text := nil.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5597
                ]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5598
            ]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5599
        ]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5600
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5601
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5602
    ^ text
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5603
!
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5604
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5605
flyByHelpText:aText
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5606
    "exlicitly set the flyBy helpText. For example, to dynamically change it.
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5607
    "
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5608
    flyByHelpText := aText.
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5609
! !
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5610
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5611
!MenuPanel::Item methodsFor:'accessing-look'!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5612
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5613
horizontalLayout
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5614
    "on default submenus has a vertical layout;
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5615
     true, the submenu has a horizontal layout.
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5616
    "
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5617
    ^ menuItem horizontalLayout ? false
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5618
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5619
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5620
horizontalLayout:aBoolean
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5621
    "on default submenus has a vertical layout;
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5622
     true, the submenu has a horizontal layout.
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5623
    "
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5624
    menuItem horizontalLayout:aBoolean.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5625
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5626
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5627
isButton
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5628
    "returns whether item looks like a Button
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5629
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5630
    ^ menuItem isButton
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5631
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5632
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5633
isButton:aBool
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5634
    "sets whether item looks like a Button
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5635
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5636
    menuItem isButton ~~ aBool ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5637
        menuItem isButton:aBool.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5638
        self invalidate.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5639
    ]
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5640
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5641
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5642
layout
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5643
    "returns my layout ( Rectangle )
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5644
    "
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5645
    ^ layout
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5646
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5647
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5648
layout:aLayout
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5649
    "set a new layout ( Rectangle )
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5650
    "
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5651
    layout := aLayout.
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5652
    self invalidate.
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5653
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5654
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5655
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5656
showBusyCursorWhilePerforming
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5657
    "get the flag which controls if a busy cursor is to be shown
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5658
     while performing the menu action. Defaults to false.
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5659
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5660
    ^ menuItem showBusyCursorWhilePerforming
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5661
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5662
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5663
showBusyCursorWhilePerforming:aBoolean
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5664
    "set/clear the flag which controls if a busy cursor is to be shown
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5665
     while performing the menu action. Defaults to false.
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5666
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5667
    menuItem showBusyCursorWhilePerforming:aBoolean.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5668
! !
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5669
2504
0ce78a73aacf method category rename
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
  5670
!MenuPanel::Item methodsFor:'activation & deactivation'!
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  5671
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5672
currentSubmenu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5673
    "returns the current submenu or nil
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5674
    "
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5675
    ^ subMenu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5676
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5677
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5678
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5679
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5680
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  5681
hideSubmenu
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  5682
    "hide submenu
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  5683
    "
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5684
    self hideSubmenu:subMenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5685
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5686
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5687
hideSubmenu:aSubmenu
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5688
    "hide submenu
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5689
    "
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  5690
    |id|
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  5691
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5692
    aSubmenu isNil ifTrue:[^ self].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5693
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5694
    aSubmenu realized ifFalse:[
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5695
        id := aSubmenu id.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5696
        id notNil ifTrue:[ menuPanel device unmapWindow:id ]
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5697
    ] ifTrue:[
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5698
        aSubmenu hide
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5699
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5700
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5701
    aSubmenu  windowGroup:nil.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5702
    menuPanel windowGroup removeView:aSubmenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5703
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5704
    "/ release menu if derived from channel
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5705
    (subMenu == aSubmenu and:[menuItem submenuChannel notNil]) ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5706
        menuItem keepLinkedMenu ifFalse:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5707
            subMenu := nil
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5708
        ]
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5709
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5710
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5711
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5712
openDelayedSubmenu
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5713
    "called to open now my delayed submenu
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5714
    "
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5715
    |subm|
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5716
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5717
    (self isSelected and:[menuPanel shown]) ifFalse:[^ self].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5718
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5719
    subMenu notNil ifTrue:[
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5720
        subMenu realized ifTrue:[
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5721
            "/ already open
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5722
            ^ self
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5723
        ].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5724
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5725
    subm := self setupSubmenu.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5726
    subm isNil ifTrue:[^ self].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5727
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5728
    self openSubmenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5729
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5730
    (subm == subMenu and:[self isSelected]) ifFalse:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5731
        "/ closed during building or opening the submenu
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5732
        self hideSubmenu:subm.
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5733
    ].
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  5734
!
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5735
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5736
openSubmenu
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5737
    "opens the submenu; make sure, that the submenu and the menPanel
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5738
     is fully visible by shifting it into the visible screen area if
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5739
     nescessary.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5740
    "
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5741
    |p o device isVertical topMenu windGrp prefExtent
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5742
     devBot   "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5743
     devRight "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5744
     width    "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5745
     height   "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5746
     top      "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5747
     left     "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5748
    |
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5749
1737
c18896a7cb50 replace shown by realized; when opening a submenue-submenue by shortcut key
ca
parents: 1735
diff changeset
  5750
    (subMenu notNil and:[subMenu shown not and:[self isSelected and:[menuPanel realized]]]) ifFalse:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5751
        ^ self
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5752
    ].
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5753
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5754
    topMenu := menuPanel topMenu.
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  5755
    (subMenu device notNil and:[topMenu device ~~ subMenu device]) ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5756
        subMenu releaseDeviceResources.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5757
        subMenu setDevice:topMenu device id:nil gcId:nil.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5758
        subMenu recreate.
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  5759
    ].
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  5760
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5761
    windGrp := topMenu windowGroup.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5762
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5763
    subMenu superMenu:menuPanel.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5764
    subMenu becomesActiveMenu.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5765
    subMenu cursor:Cursor hand.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5766
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5767
    windGrp notNil ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5768
        subMenu windowGroup:windGrp.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5769
        windGrp addTopView:subMenu.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5770
    ].
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5771
2111
f3d67f7c0f92 bug fix when opening a menu by mnemonic
ca
parents: 2100
diff changeset
  5772
    "Q&D kludge - test whether the layout is nil;
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5773
                  if true recompute the layouts
2111
f3d67f7c0f92 bug fix when opening a menu by mnemonic
ca
parents: 2100
diff changeset
  5774
    "
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5775
    layout isNil ifTrue:[menuPanel rearrangeItems].
2111
f3d67f7c0f92 bug fix when opening a menu by mnemonic
ca
parents: 2100
diff changeset
  5776
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5777
    " Q&D kludge - if any visibility attributes are blocks;
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5778
      TODO: only invoke mustRearrange if any are blocks
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5779
            (since I react correctly on valueHolder changes)
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5780
    "
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5781
    subMenu rearrangeItemsIfItemVisibilityChanged.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5782
    subMenu fixSize.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5783
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5784
    "compute origin of subMenu
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5785
    "
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5786
    isVertical := menuPanel verticalLayout.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5787
    device     := menuPanel device.
1714
b4c05977e9d5 get heigth and width from preferredExtent when open a submenu
ca
parents: 1710
diff changeset
  5788
    prefExtent := subMenu preferredExtent.
b4c05977e9d5 get heigth and width from preferredExtent when open a submenu
ca
parents: 1710
diff changeset
  5789
    height     := prefExtent y.
b4c05977e9d5 get heigth and width from preferredExtent when open a submenu
ca
parents: 1710
diff changeset
  5790
    width      := prefExtent x.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5791
    devBot     := device  usableHeight.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5792
    devRight   := device  usableWidth.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5793
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5794
    p := isVertical ifTrue:[layout topRight - 2] ifFalse:[layout bottomLeft].
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5795
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5796
    menuPanel isPopUpView ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5797
        o := menuPanel origin + p
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5798
    ] ifFalse:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5799
        o := menuPanel translatePoint:p to:nil.   "/ translate to root window
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5800
    ].
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5801
    left := o x.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5802
    top  := o y.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5803
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5804
    top + height > devBot ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5805
        top := isVertical ifTrue:[devBot - height]
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5806
                         ifFalse:[top - layout height - height + 2]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5807
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5808
    top := top max:0.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5809
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5810
"/    (isVertical not and:[subMenu isVerticalLayout]) ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5811
"/        top < menuPanel bottom ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5812
"/            left := left + layout width.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5813
"/        ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5814
"/        left + width > devRight ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5815
"/            left := o x - width - 2
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5816
"/        ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5817
"/    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5818
        
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5819
    left + width > devRight ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5820
        left := isVertical ifTrue:[left - layout width - width + 2]
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5821
                          ifFalse:[devRight - width]
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5822
    ].
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5823
    left := left max:0.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5824
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5825
    subMenu origin:(left@top).
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5826
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5827
    subMenu realized ifFalse:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5828
        subMenu realize. 
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5829
    ] ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5830
        topMenu device mapWindow:(subMenu id).
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5831
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5832
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5833
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5834
toggleSubmenuVisibility
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5835
    "toggle the visibility of the submenu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5836
    "
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5837
    subMenu notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5838
	subMenu shown ifTrue:[^ self hideSubmenu]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5839
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5840
	(subMenu := self setupSubmenu) isNil ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5841
	    "/ cannot open a submenu
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5842
	    ^ self
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5843
	]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5844
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5845
    self openSubmenu.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5846
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5847
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5848
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5849
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5850
visibleSubmenu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5851
    "returns the current visible submenu or nil
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5852
    "
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5853
    subMenu notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5854
	subMenu shown ifTrue:[^ subMenu].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5855
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5856
    ^ nil
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5857
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5858
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5859
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5860
! !
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5861
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5862
!MenuPanel::Item methodsFor:'building'!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5863
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5864
aspectAt:aKey
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5865
    "retursns value assigned to key or nil
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5866
    "
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5867
    |appl value|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5868
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5869
    appl := menuPanel receiver.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5870
1219
6a0d677a6fac removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents: 1218
diff changeset
  5871
    (appl isValueModel) ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5872
        ^ appl value:aKey
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5873
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5874
2123
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  5875
    appl isNil ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5876
        appl := menuPanel application.
2123
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  5877
    ].
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  5878
    appl isNil ifTrue:[ ^ nil].
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  5879
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  5880
    MessageNotUnderstood handle:[:ex|
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5881
        ex selector == aKey ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5882
            ex reject
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5883
        ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5884
        self ifNotInUIBuilderInfoPrintCR:
2545
e838be7f2c83 Tell application name in info message about no-existing aspects.
Stefan Vogel <sv@exept.de>
parents: 2505
diff changeset
  5885
            ('MenuPanel::Item [info]: application (class %1) does not provide aspect: %2' 
e838be7f2c83 Tell application name in info message about no-existing aspects.
Stefan Vogel <sv@exept.de>
parents: 2505
diff changeset
  5886
             bindWith:appl className with:aKey).
2123
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  5887
    ] do:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5888
        aKey numArgs == 1 ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5889
            value := appl perform:aKey with:(menuItem argument ? self).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5890
        ] ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5891
            (appl respondsTo:#aspectFor:) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5892
                value := appl aspectFor:aKey
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5893
            ] ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5894
                value := appl perform:aKey
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5895
            ]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5896
        ]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5897
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5898
    ^ value
1029
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  5899
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  5900
    "Modified: / 29.7.1998 / 11:59:50 / cg"
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5901
! !
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5902
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5903
!MenuPanel::Item methodsFor:'change & update'!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5904
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5905
update:something with:aParameter from:changedObject
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5906
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5907
    |form rect|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5908
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5909
    (menuPanel isNil or:[layout isNil]) ifTrue:[^ self].        "/ not yet realized or computed
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5910
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5911
    self isSeparator ifFalse:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5912
        "/ NOT A SEPARATOR
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5913
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5914
        menuPanel shown ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5915
            changedObject == enableChannel ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5916
                (enableChannel value == false and:[self isSelected]) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5917
                    ^ menuPanel selection:nil.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5918
                ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5919
                ^ self invalidate
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5920
            ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5921
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5922
            (changedObject == indication or:[changedObject == choice]) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5923
                menuItem isButton ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5924
                    self invalidate
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5925
                ] ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5926
                    "/ invalidate the interactor only
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5927
                    "/ take any interactor; interactors has the same extent
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5928
                    form := menuPanel iconIndicationOff.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5929
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5930
                    rect := Rectangle left:(layout left + HorizontalInset)
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5931
                                       top:(layout top)
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5932
                                     width:(form width)
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5933
                                    height:(layout height).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5934
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5935
                    menuPanel invalidate:rect repairNow:false
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5936
                ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5937
                ^ self
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5938
            ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5939
        ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  5940
    ].
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5941
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5942
    changedObject == isVisible ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5943
        menuPanel mustRearrange.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5944
        menuPanel rearrangeItems.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5945
        ^ self.
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5946
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5947
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  5948
    super update:something with:aParameter from:changedObject
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5949
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5950
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5951
updateIndicators
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5952
    "update indicators
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5953
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5954
    (indication notNil and:[indication isSymbol]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5955
	" indication is a selector otherwise a change notification
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5956
	  is raised from the model !!!!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5957
	"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5958
	self update:nil with:nil from:indication
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5959
    ]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5960
! !
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5961
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5962
!MenuPanel::Item methodsFor:'converting'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5963
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5964
asMenuItem
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5965
    "convert to a MenuItem
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5966
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5967
    ^ menuItem
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5968
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5969
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5970
menuItem:aMenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5971
    "setup attributes from a MenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5972
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5973
    |lbl|
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5974
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5975
    menuPanel disabledRedrawDo:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5976
        menuItem := aMenuItem.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5977
        menuItem isNil ifTrue:[ menuItem := MenuItem new].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5978
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5979
        label := displayLabel := activeHelpText := nil.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5980
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5981
        self    enabled:(menuItem enabled).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5982
        self indication:(menuItem indication).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5983
        self     choice:(menuItem choice).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5984
        self  isVisible:(menuItem isVisible ? true).
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5985
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5986
"/ we should call here resourceRetriever insteat of labelImage
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5987
"/ but ... ??
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5988
        (lbl := menuItem labelImage value) isNil ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5989
            lbl := menuItem rawLabel. "/ avoid translating &'s twice
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5990
        ].
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5991
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5992
        self submenu:(menuItem submenu).
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5993
        self label:lbl.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5994
    ]
1033
9badc22e3d03 oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents: 1032
diff changeset
  5995
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  5996
    "Modified: / 22.8.1998 / 15:34:16 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5997
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5998
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5999
!MenuPanel::Item methodsFor:'drawing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6000
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6001
draw
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6002
    "redraw item
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6003
    "
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6004
    |isSelected ownBgCol paint bgColor
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6005
     x  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6006
     y  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6007
     w  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6008
     h  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6009
    |
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6010
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6011
    self isVisible ifFalse:[^ self].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6012
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6013
    self isSeparator ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6014
        self drawSeparator.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6015
        ^ self
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6016
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6017
    menuItem isButton ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6018
        self drawButton.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6019
        ^ self
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6020
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6021
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6022
    "/ DRAW A LABELED ENTRY; no button, no separator
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6023
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6024
    isSelected := self isSelected.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6025
    bgColor    := menuPanel backgroundColor.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6026
    paint      := isSelected 
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6027
                    ifTrue:[self activeBackgroundColor] 
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6028
                    ifFalse:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6029
                        (self isEnabled and:[ self isEntered ]) ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6030
                            menuPanel enteredBackgroundColor
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6031
                        ] ifFalse:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6032
                            bgColor
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6033
                        ]].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6034
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6035
    (ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6036
        paint := ownBgCol
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6037
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6038
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6039
    paint ~= bgColor ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6040
        menuPanel paint:paint.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6041
        menuPanel fillRectangle:layout.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6042
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6043
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6044
    menuPanel showSeparatingLines ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6045
        self drawSeparatingLines
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6046
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6047
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6048
    self drawLabel.  
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6049
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6050
    (ownBgCol notNil and:[isSelected]) ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6051
        ownBgCol brightness > 0.5 ifTrue:[menuPanel paint: menuPanel selectionFrameDarkColor]
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6052
                                 ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6053
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6054
        x := layout left.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6055
        y := layout top.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6056
        w := layout width.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6057
        h := layout height.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6058
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6059
        menuPanel displayRectangleX:(x + 1) y:(y + 1) width:(w - 2) height:(h - 2).
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6060
        menuPanel displayRectangleX:(x + 2) y:(y + 2) width:(w - 4) height:(h - 4).  
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6061
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6062
    menuPanel drawLabelEdgeFor:self selected:isSelected.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6063
!
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6064
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6065
drawButton
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6066
    "draw as button
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6067
    "
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6068
    |drawObject fg etchFg level isEnabled isSelected bg ownBgCol showSelected
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6069
     x "{ Class:SmallInteger }"
2143
7b99a7348c97 draw label shifted right-down when pressed
penk
parents: 2142
diff changeset
  6070
     y "{ Class:SmallInteger }"
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6071
    |
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6072
    drawObject := displayLabel.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6073
    isEnabled  := self enabled.
2159
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  6074
    isSelected := self isSelected.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6075
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6076
    isSelected ifFalse:[
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6077
        "/ test whether button has pressed toggle behaviour
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6078
        showSelected := (self isToggle and:[self indicationValue]).
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6079
    ] ifTrue:[
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6080
        showSelected := isSelected
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6081
    ].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6082
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6083
    showSelected ifTrue:[
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6084
        bg := self activeBackgroundColor.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6085
        fg := self activeForegroundColor.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6086
    ] ifFalse:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6087
        self isEntered ifTrue:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6088
            bg := self buttonEnteredBackgroundColor
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6089
        ] ifFalse:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6090
            bg := self backgroundColor
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6091
        ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6092
        isEnabled ifTrue:[
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6093
            fg := menuPanel foregroundColor
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6094
        ] ifFalse:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6095
            fg := menuPanel disabledForegroundColor.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6096
            etchFg := menuPanel disabledEtchedForegroundColor.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6097
            drawObject := self disabledRawLabel
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6098
        ]
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6099
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6100
1708
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  6101
    (ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  6102
        bg := ownBgCol
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  6103
    ].
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  6104
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6105
    "DRAW BACKGROUND"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6106
    bg ~= menuPanel backgroundColor ifTrue:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6107
        menuPanel paint:bg.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6108
        menuPanel fillRectangle:layout.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6109
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6110
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6111
    x := layout left + menuPanel buttonPassiveLevel + HorizontalButtonInset.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6112
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6113
    (drawObject isImage and:[menuPanel centerItems]) ifTrue:[
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  6114
        x := x + (layout width - menuPanel buttonPassiveLevel - HorizontalButtonInset - 1 - drawObject width // 2).
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  6115
    ].
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6116
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6117
    isSelected ifFalse:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6118
        "check whether button should be drawn selected; indicator or radio button"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6119
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6120
        indication notNil ifTrue:[
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6121
            "button is indicator and set"
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6122
            isSelected := self indicationValue
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6123
        ] ifFalse:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6124
            isSelected := (choice notNil and:[choice value = menuItem choiceValue]).
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6125
        ]
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6126
    ].
2143
7b99a7348c97 draw label shifted right-down when pressed
penk
parents: 2142
diff changeset
  6127
    y := 0.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6128
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6129
    isSelected ifTrue:[   
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6130
        level := menuPanel buttonActiveLevel.
2142
ea2a32738005 pressed button label only shifted by one pixel
penk
parents: 2141
diff changeset
  6131
        x     := x + 1 "level abs".
2143
7b99a7348c97 draw label shifted right-down when pressed
penk
parents: 2142
diff changeset
  6132
        y     := y + 1 "level abs".
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6133
    ] ifFalse:[   
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6134
        level := self isEntered ifTrue:[menuPanel buttonEnteredLevel]
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6135
                               ifFalse:[menuPanel buttonPassiveLevel].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6136
    ].
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6137
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6138
    drawObject isEmptyOrNil ifFalse:[
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6139
        etchFg notNil ifTrue:[
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6140
            self drawRawLabel:drawObject atX:x+1 yOffset:y+1 paint:etchFg.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6141
        ].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6142
        self drawRawLabel:drawObject atX:x yOffset:y+0 paint:fg.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6143
    ].
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6144
    self drawMenuIndicator.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6145
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6146
    level ~~ 0 ifTrue:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6147
        menuPanel drawButtonEdgesFor:self level:level
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6148
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6149
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6150
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6151
drawLabel
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  6152
    "draw a labeled entry; no button, no separator.
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  6153
    "
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6154
    |scKey cLb cLa drawObject fg etchFg arrow 
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6155
     isSelected isEnabled form
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6156
     h "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6157
     y "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6158
     x "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6159
     t "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6160
    |
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6161
    drawObject := displayLabel.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6162
    isEnabled  := self enabled.
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6163
    isSelected := self isSelected.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6164
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6165
    isSelected ifTrue:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6166
        fg := self activeForegroundColor
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6167
    ] ifFalse:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6168
        isEnabled ifTrue:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6169
            self isEntered ifTrue:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6170
                fg := menuPanel enteredForegroundColor
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6171
            ] ifFalse:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6172
                fg := menuPanel foregroundColor
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6173
            ]
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6174
        ] ifFalse:[
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6175
            fg          := menuPanel disabledForegroundColor.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6176
            etchFg      := menuPanel disabledEtchedForegroundColor.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6177
            drawObject  := self disabledRawLabel
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6178
        ]
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6179
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6180
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6181
    h := layout height.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6182
    x := layout left + HorizontalInset.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6183
    t := layout top.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6184
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6185
    ((form := self indicatorForm) notNil or:[(form := self choiceForm) notNil]) ifTrue:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6186
        y := t + ((h - form height) // 2).
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6187
        
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6188
        form displayOn:menuPanel x:x y:y.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6189
        x := x + 2 + form width.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6190
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6191
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6192
    drawObject isEmptyOrNil ifFalse:[
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6193
        etchFg notNil ifTrue:[
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6194
            self drawRawLabel:drawObject atX:x+1 yOffset:1 paint:etchFg.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6195
        ].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6196
        self drawRawLabel:drawObject atX:x yOffset:0 paint:fg.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6197
    ].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6198
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6199
    self drawMenuIndicator.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6200
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6201
    "/ DRAW SHORTCUT KEY
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6202
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6203
    (     menuItem shortcutKey notNil
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6204
     and:[(x := menuPanel shortKeyInset) ~~ 0
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6205
     and:[(scKey:= self shortcutKeyAsString) notNil]]
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6206
    ) ifTrue:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6207
        x := layout left + x.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6208
        y := t + ((h - (scKey heightOn:menuPanel)) // 2).
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6209
        y := y + menuPanel font ascent.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6210
        scKey displayOn:menuPanel x:x y:y. 
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6211
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6212
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6213
    "/ DRAW SUBMENU INDICATION
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6214
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6215
    (menuPanel isVerticalLayout and:[self hasSubmenu]) ifFalse:[
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6216
        ^ self
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6217
    ].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6218
    arrow := menuPanel rightArrow.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6219
    x := layout right - arrow width - HorizontalInset.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6220
    y := t + (h - arrow height // 2).
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6221
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6222
    (menuPanel styleSheet is3D not
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6223
    or:[(drawObject := menuPanel rightArrowShadow) isNil]) ifTrue:[
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6224
        ^ menuPanel displayForm:arrow x:x y:y
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6225
    ].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6226
    cLa := menuPanel shadowColor.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6227
    cLb := menuPanel lightColor.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6228
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6229
    isSelected ifFalse:[
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6230
        fg  := cLa.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6231
        cLa := cLb.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6232
        cLb := fg
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6233
    ].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6234
    menuPanel paint:cLa.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6235
    menuPanel displayForm:arrow x:x y:y.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6236
    menuPanel paint:cLb.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6237
    menuPanel displayForm:drawObject x:x y:y. 
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6238
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6239
    "Modified: / 6.9.1998 / 21:48:53 / cg"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6240
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6241
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6242
drawMenuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6243
    "draw a menu indicator if the item has a menu or delayed menu.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6244
    "
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6245
    |x y icon bAbsLevel|
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  6246
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6247
    self hasDelayedMenuIndicator ifTrue:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6248
        icon := MenuPanel delayedMenuIndicator.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6249
    ] ifFalse:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6250
        self hasMenuIndicator ifTrue:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6251
            icon := MenuPanel menuIndicator.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6252
        ] ifFalse:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6253
            ^ self
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6254
        ]
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6255
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6256
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  6257
    x := layout right  - icon width.
2460
9afb27f470a7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  6258
    false "delayedMenuIndicatorVerticalPosition == #center" ifTrue:[
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6259
        y := layout height - icon height // 2 + layout top.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6260
    ] ifFalse:[
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6261
        y := layout bottom - icon height - 2.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6262
    ].
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6263
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6264
    bAbsLevel := 0.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6265
    menuItem isButton ifTrue:[
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6266
        self isSelected ifTrue:[
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6267
            x := x + 1.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6268
            y := y + 1.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6269
        ].
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6270
        bAbsLevel := menuPanel maxAbsoluteButtonLevel.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6271
        x := x - bAbsLevel.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6272
        y := y - bAbsLevel.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6273
    ].
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6274
    x := x - 1 "- HorizontalInset".
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6275
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6276
    (self isEnabled "and:[self delayedMenuIsEnabled]") ifFalse:[
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6277
        icon := menuPanel lightenedImageOnDevice:icon
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  6278
    ].
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  6279
    icon displayOn:menuPanel x:x y:y.
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6280
2234
29eba50f76eb drawColSep beautified;
Claus Gittinger <cg@exept.de>
parents: 2232
diff changeset
  6281
    (false "drawDelayedMenuIndicatorSeparator" and:[ menuPanel buttonPassiveLevel ~~ 0 ])
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6282
    ifTrue:[
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6283
        menuPanel paint:menuPanel buttonShadowColor.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6284
        menuPanel displayLineFromX:x-2 y:layout top+bAbsLevel+1 toX:x-2 y:layout bottom-bAbsLevel-2.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6285
        menuPanel paint:menuPanel buttonLightColor.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6286
        menuPanel displayLineFromX:x-1 y:layout top+bAbsLevel+1 toX:x-1 y:layout bottom-bAbsLevel-2.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6287
    ].
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  6288
!
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  6289
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6290
drawRawLabel:aLabel atX:x yOffset:yOffset paint:fg
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6291
    "draw a labeled entry; no button, no separator.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6292
    "
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6293
    |mfont fontAscent
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6294
     y  "{ Class:SmallInteger }"
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6295
     y0 "{ Class:SmallInteger }"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6296
     x0 "{ Class:SmallInteger }"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6297
    |
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6298
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6299
    mfont := menuPanel setFont:(self font).
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6300
    "/ fontAscent := menuPanel font ascent.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6301
    menuPanel paint:fg.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6302
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6303
    y := layout top + (layout height - displayLabelExtent y // 2) + yOffset.
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  6304
"/  menuPanel centerItems ifTrue:[self halt].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6305
    aLabel isArray ifFalse:[
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6306
        y := y + (aLabel ascentOn:menuPanel).
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6307
"/        aLabel isImageOrForm ifFalse:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6308
"/            y := y + fontAscent.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6309
"/        ].
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  6310
        aLabel displayOn:menuPanel x:x y:y.
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6311
    ] ifTrue:[
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  6312
        aLabel do:[:el|
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  6313
            el notNil ifTrue:[
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6314
                y0 := y + (el ascentOn:menuPanel).
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6315
"/                el isImageOrForm ifFalse:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6316
"/                    y0 := y + fontAscent
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6317
"/                ] ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6318
"/                    y0 := y
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6319
"/                ].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6320
                x0 := x + (displayLabelExtent x - (el widthOn:menuPanel) // 2).
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  6321
                el displayOn:menuPanel x:x0 y:y0.
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  6322
                y := y + 1 + (el heightOn:menuPanel)
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  6323
            ] ifFalse:[
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6324
                y := y + (self spaceBetweenEmptyLines) 
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  6325
            ]
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  6326
        ].
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6327
    ].
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6328
    menuPanel setFont:mfont
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6329
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6330
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6331
drawSeparatingLines
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6332
    "draw separating lines
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6333
    "
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6334
    |myIndex lfSep rtSep items prevItem nextItem
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6335
     lightColor shadowColor
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6336
     l "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6337
     t "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6338
     r "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6339
     b "{ Class:SmallInteger }"
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  6340
    |
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6341
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6342
    items := menuPanel items.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6343
    myIndex := items identityIndexOf:self.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6344
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6345
    prevItem  := items at:(myIndex - 1) ifAbsent:nil.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6346
    lfSep := prevItem notNil and:[prevItem isButton not].
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6347
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6348
    nextItem  := items at:(myIndex + 1) ifAbsent:nil.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6349
    rtSep := nextItem notNil and:[nextItem isButton not].
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6350
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6351
    (lfSep or:[rtSep]) ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6352
	^ self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6353
    ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6354
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6355
    lightColor := menuPanel lightColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6356
    shadowColor := menuPanel shadowColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6357
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6358
    menuPanel paint:lightColor.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6359
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  6360
    l := layout left.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  6361
    t := layout top.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  6362
    r := layout right.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  6363
    b := layout bottom.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6364
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6365
    menuPanel verticalLayout ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6366
	lfSep ifTrue:[menuPanel displayLineFromX:l y:t-1 toX:r y:t-1].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6367
	rtSep ifTrue:[menuPanel displayLineFromX:l y:b-1 toX:r y:b-1].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6368
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6369
	menuPanel paint:shadowColor.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6370
	lfSep ifTrue:[menuPanel displayLineFromX:l y:t-2 toX:r y:t-2].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6371
	rtSep ifTrue:[menuPanel displayLineFromX:l y:b-2 toX:r y:b-2].
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6372
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6373
	lfSep ifTrue:[menuPanel displayLineFromX:l-1 y:t toX:l-1 y:b].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6374
	rtSep ifTrue:[menuPanel displayLineFromX:r-1 y:t toX:r-1 y:b].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6375
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6376
	menuPanel paint:shadowColor.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6377
	lfSep ifTrue:[menuPanel displayLineFromX:l-2 y:t toX:l-2 y:b].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6378
	rtSep ifTrue:[menuPanel displayLineFromX:r-2 y:t toX:r-2 y:b]. 
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6379
    ]
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6380
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6381
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6382
drawSeparator
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6383
    "draw as separator
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6384
    "
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6385
    |type lightColor shadowColor isDouble
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6386
     left top
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6387
     x0  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6388
     x1  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6389
     y0  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6390
     y1  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6391
    |
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6392
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6393
    type := self separatorType.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6394
    (type isNil or:[type == #blankLine]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6395
	^ self
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6396
    ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6397
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6398
    isDouble := type == #doubleLine.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6399
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6400
    lightColor := menuPanel lightColor.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6401
    shadowColor := menuPanel shadowColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6402
    menuPanel paint:shadowColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6403
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6404
    left := layout left.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6405
    top := layout top.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6406
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6407
    menuPanel verticalLayout ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6408
	x0 := left  + HorizontalInset.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6409
	x1 := layout right - HorizontalInset.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6410
	y0 := top   - 1 + (layout height // 2).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6411
	isDouble ifTrue:[y0 := y0 - 2].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6412
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6413
	menuPanel displayLineFromX:x0 y:y0   toX:x1 y:y0.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6414
	isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+4 toX:x1 y:y0+4].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6415
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6416
	menuPanel paint:lightColor.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6417
	menuPanel displayLineFromX:x0 y:y0+1 toX:x1 y:y0+1.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6418
	isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+5 toX:x1 y:y0+5].
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6419
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6420
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6421
	y1 := layout bottom.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6422
	x0 := left - 1 + (layout width // 2).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6423
	y0 := top.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6424
	isDouble ifTrue:[x0 := x0 - 2].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6425
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6426
	menuPanel displayLineFromX:x0   y:y0 toX:x0   y:y1.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6427
	isDouble ifTrue:[menuPanel displayLineFromX:x0+4 y:y0 toX:x0+4 y:y1].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6428
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6429
	menuPanel paint:lightColor.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6430
	menuPanel displayLineFromX:x0+1 y:y0 toX:x0+1 y:y1.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6431
	isDouble ifTrue:[menuPanel displayLineFromX:x0+5 y:y0 toX:x0+5 y:y1].
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6432
    ]
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6433
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6434
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6435
invalidate
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6436
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6437
    layout isNil ifTrue:[^ self].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6438
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6439
    (displayLabel notNil and:[menuPanel notNil]) ifTrue:[
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6440
        menuPanel invalidateItem:self repairNow:false
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6441
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6442
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6443
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6444
!MenuPanel::Item methodsFor:'initialization'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6445
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6446
destroy
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6447
    "destroy submenus, remove dependencies
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6448
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6449
    self submenu:nil.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6450
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6451
    enableChannel isValueModel ifTrue:[enableChannel removeDependent:self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6452
    isVisible     isValueModel  ifTrue:[isVisible    removeDependent:self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6453
    indication    isValueModel ifTrue:[indication    removeDependent:self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6454
    choice        isValueModel ifTrue:[choice        removeDependent:self].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6455
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6456
    menuPanel := nil.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6457
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6458
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6459
in:aPanel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6460
    "create item in a menuPanel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6461
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6462
    menuPanel := aPanel.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6463
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6464
    menuItem isNil ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6465
        self halt.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6466
        menuItem := MenuItem new
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6467
    ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6468
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6469
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6470
initialize
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6471
    menuItem := MenuItem new.
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  6472
!
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  6473
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  6474
reinitStyle
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  6475
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  6476
    subMenu notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6477
	subMenu reinitStyle
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  6478
    ].
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  6479
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  6480
    "Created: / 17.8.2000 / 17:57:07 / cg"
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  6481
    "Modified: / 17.8.2000 / 18:00:08 / cg"
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6482
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6483
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6484
!MenuPanel::Item methodsFor:'label basics'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6485
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6486
disabledRawLabel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6487
    "returns the label used if the item is disabled
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6488
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6489
    |block form image|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6490
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6491
    disabledDisplayLabel notNil ifTrue:[^ disabledDisplayLabel].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6492
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6493
    disabledDisplayLabel := displayLabel ? ''.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6494
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6495
    disabledDisplayLabel isString ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6496
        ^ disabledDisplayLabel
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6497
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6498
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6499
    block := [:el| |rslt|
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6500
        (rslt := el) notNil ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6501
            el isImageOrForm ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6502
                el colorMap notNil ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6503
                    rslt := menuPanel lightenedImageOnDevice:el
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6504
                ]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6505
            ] ifFalse:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6506
                (displayLabel isKindOf:LabelAndIcon) ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6507
                    ((form := el icon) notNil and:[form colorMap notNil]) ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6508
                        form := menuPanel lightenedImageOnDevice:form
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6509
                    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6510
                    ((image := el image) notNil and:[image colorMap notNil]) ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6511
                        image := menuPanel lightenedImageOnDevice:image
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6512
                    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6513
                    rslt := LabelAndIcon form:form image:image string:(el string).
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6514
                ]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6515
            ]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6516
        ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6517
        rslt
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6518
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6519
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6520
    displayLabel isArray ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6521
        disabledDisplayLabel := Array new:(displayLabel size).
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6522
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6523
        displayLabel keysAndValuesDo:[:anIndex :aLabel|
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6524
            disabledDisplayLabel at:anIndex put:(block value:aLabel)
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6525
        ]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6526
    ] ifFalse:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6527
        disabledDisplayLabel := block value:displayLabel
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6528
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6529
    ^ disabledDisplayLabel
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6530
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6531
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  6532
fetchDeviceResources
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6533
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6534
    disabledDisplayLabel := nil.
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  6535
    self fetchImages.
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  6536
!
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  6537
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6538
fetchImages
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6539
    "fetch images
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6540
    "
2118
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  6541
    |icon|
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  6542
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6543
    (displayLabel isNil or:[displayLabel isString]) ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6544
        ^ self
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6545
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6546
    displayLabel isImageOrForm ifTrue:[
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  6547
        displayLabel := menuPanel imageOnMyDevice:displayLabel.
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6548
        ^ self.  
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6549
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6550
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6551
    (displayLabel isKindOf:LabelAndIcon) ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6552
        (icon := displayLabel image) notNil ifTrue:[
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  6553
            displayLabel image:(menuPanel imageOnMyDevice:icon)
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6554
        ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6555
        (icon := displayLabel icon) notNil ifTrue:[
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  6556
            displayLabel icon:(menuPanel imageOnMyDevice:icon)
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6557
        ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6558
        ^ self
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6559
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6560
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6561
    displayLabel isArray ifFalse:[^ self].            
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6562
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6563
    displayLabel keysAndValuesDo:[:i :el|
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6564
        (el notNil and:[el isString not]) ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6565
            el isImageOrForm ifTrue:[
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  6566
                displayLabel at:i put:(menuPanel imageOnMyDevice:el).
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6567
            ] ifFalse:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6568
                el class == LabelAndIcon ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6569
                    (icon := el image) notNil ifTrue:[
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  6570
                        el image:(menuPanel imageOnMyDevice:icon)
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6571
                    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6572
                    (icon := el icon) notNil ifTrue:[
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  6573
                        el icon:(menuPanel imageOnMyDevice:icon)
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6574
                    ]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6575
                ]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6576
            ]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6577
        ]
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  6578
    ].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6579
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6580
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6581
updateAccessCharacterFor:aLabel
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6582
    |s i rest label pos|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6583
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6584
    (accessCharacter notNil or:[aLabel isNil]) ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6585
        ^ aLabel
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6586
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6587
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6588
    aLabel isString ifFalse:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6589
        aLabel class == LabelAndIcon ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6590
            aLabel string:(self updateAccessCharacterFor:(aLabel string))
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6591
        ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6592
        ^ aLabel
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6593
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6594
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6595
    s := aLabel size.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6596
    i := 1.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6597
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6598
    label := aLabel.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6599
    pos := menuItem accessCharacterPosition.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6600
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6601
    [((i := label indexOf:$& startingAt:i) ~~ 0 and:[i < s])] whileTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6602
        rest := label copyFrom:(i+1).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6603
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6604
        i == 1 ifTrue:[label := rest]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6605
              ifFalse:[label := (label copyFrom:1 to:(i-1)), rest].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6606
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6607
        (label at:i) == $& ifTrue:[i := i + 1] ifFalse:[pos := i].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6608
        s := s - 1.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6609
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6610
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6611
    (pos isNil or:[(accessCharacter := label at:pos ifAbsent:nil) isNil]) ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6612
        ^ label
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6613
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6614
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6615
    label isText ifFalse:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6616
        label := Text string:label
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6617
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6618
    label emphasisAt:pos add:#underline.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6619
    ^ label
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6620
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6621
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  6622
!MenuPanel::Item methodsFor:'printing & storing'!
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  6623
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  6624
displayString
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  6625
    ^ self class name, '[', label printString, ']'
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  6626
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  6627
! !
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  6628
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6629
!MenuPanel::Item methodsFor:'private'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6630
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  6631
activeBackgroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  6632
    "returns the active background color derived from menuPanel
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  6633
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6634
    menuItem isButton ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6635
        ^ menuPanel buttonActiveBackgroundColor
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6636
    ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6637
    ^ menuPanel activeBackgroundColor
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  6638
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  6639
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  6640
activeForegroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  6641
    "returns the active foreground color derived from menuPanel
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  6642
    "
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  6643
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  6644
    ^menuPanel activeForegroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  6645
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  6646
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  6647
backgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  6648
    "returns the background color derived from menuPanel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  6649
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6650
    menuItem isButton ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6651
        ^ menuPanel buttonPassiveBackgroundColor
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6652
    ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6653
    ^ menuPanel backgroundColor
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  6654
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  6655
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6656
backgroundColorFromLabel
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6657
    "returns the background color derived from label or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6658
    "
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6659
    |run|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6660
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6661
    label isText ifFalse:[^ nil ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6662
    run := label emphasis.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6663
    run size == 0 ifTrue:[^ nil ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6664
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6665
    run := run first.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6666
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6667
    run size == 0 ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  6668
	(run value isColor and:[run key == #backgroundColor]) ifTrue:[
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  6669
	    ^ run value
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  6670
	]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6671
    ] ifFalse:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  6672
	run do:[:r|
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  6673
	    (r value isColor and:[r key == #backgroundColor]) ifTrue:[
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  6674
		^ r value
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  6675
	    ]
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  6676
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6677
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6678
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6679
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6680
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6681
buttonEnteredBackgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6682
    "returns the background color to use when thhe mouse has entered 
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6683
     derived from menuPanel
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6684
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6685
    menuItem isButton ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6686
        ^ menuPanel buttonEnteredBackgroundColor
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6687
    ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6688
    ^ menuPanel backgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6689
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6690
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6691
choiceForm
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6692
    "returns choice form or nil
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6693
    "
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  6694
    |isOn|
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  6695
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6696
    choice isNil ifTrue:[^ nil].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6697
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6698
    isOn := (choice value = menuItem choiceValue).
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  6699
    self enabled ifFalse:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6700
        ^ isOn ifTrue:[menuPanel iconRadioGroupDisabledOn]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6701
               ifFalse:[menuPanel iconRadioGroupDisabledOff]
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  6702
    ].
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  6703
    ^ isOn ifTrue:[menuPanel iconRadioGroupOn]
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6704
           ifFalse:[menuPanel iconRadioGroupOff]
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6705
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6706
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  6707
findSubMenuIn:aRecv
1051
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  6708
    "ask the receiver for a submenu aspect, sending it
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  6709
     #aspectFor: first; then trying the selector itself.
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  6710
     Ignore the error if that message is not understood
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  6711
     (but not other message-not-understoods)"
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  6712
2069
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  6713
    |subm sel numArgs|
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  6714
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  6715
    aRecv isNil ifTrue:[^ nil].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  6716
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6717
    sel := menuItem submenuChannel.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6718
    sel isString ifFalse:[^ nil].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6719
    sel := sel asSymbol.
2069
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  6720
    numArgs := sel numArgs.
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  6721
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  6722
    numArgs == 0 ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6723
        MessageNotUnderstood handle:[:ex |
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6724
            |selector|
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6725
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6726
            ((selector := ex message selector) == sel
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6727
            or:[selector == #aspectFor:]) ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6728
                ex reject
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6729
            ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6730
        ] do:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6731
            subm := aRecv aspectFor:sel.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6732
        ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6733
        subm notNil ifTrue:[^ subm].
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  6734
    ].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  6735
2043
133a9674bcdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  6736
    (Array with:(aRecv) with:(aRecv class))
133a9674bcdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  6737
    do:[:aPossibleReceiver |
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6738
        MessageNotUnderstood handle:[:ex|
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6739
            ex message selector == sel ifFalse:[ ex reject ]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6740
        ] do:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6741
            numArgs == 0 ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6742
                subm := aPossibleReceiver perform:sel
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6743
            ] ifFalse:[ 
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6744
                numArgs == 1 ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6745
                    subm := aPossibleReceiver perform:sel with:(menuItem argument ? menuPanel)
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6746
                ] ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6747
                    subm := aPossibleReceiver perform:sel with:(menuItem argument) with:menuPanel
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6748
                ]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6749
            ]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6750
        ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6751
        subm notNil ifTrue:[^ subm].
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  6752
    ].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  6753
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  6754
    ^ subm
2043
133a9674bcdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  6755
133a9674bcdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  6756
    "Modified: / 30.10.2001 / 13:28:25 / cg"
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  6757
!
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  6758
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6759
indicationValue
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6760
    "returns indication value or nil in case of no indication
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6761
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6762
    |numArgs sel recv|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6763
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6764
    indication isNil ifTrue:[^ nil].                                    "no indication specified"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6765
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6766
    indication isSymbol ifFalse:[                                       
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6767
        ^ indication value == true                                      "block or model"
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6768
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6769
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6770
    (numArgs := indication numArgs) == 2 ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6771
        recv := menuPanel receiver.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6772
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6773
        (recv isValueModel) ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6774
            (recv notNil or:[(recv := menuPanel application) notNil]) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6775
                sel := indication copyFrom:1 to:(indication indexOf:$:).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6776
                sel := sel asSymbol.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6777
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6778
                MessageNotUnderstood handle:[:ex| 
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6779
                    ex message selector == sel ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6780
                        ex reject
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6781
                    ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6782
                ] do:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6783
                    sel := recv perform:sel with:(menuItem argument)
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6784
                ]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6785
            ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6786
        ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6787
        ^ sel value == true
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6788
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6789
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6790
    numArgs ~~ 0 ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6791
        sel := (indication copyWithoutLast:1) asSymbol
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6792
    ] ifFalse:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6793
        sel := indication
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6794
    ].    
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6795
    sel := self aspectAt:sel.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6796
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6797
    sel isValueModel ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6798
        indication := sel.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6799
        indication addDependent:self.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6800
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6801
    ^ sel value == true
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6802
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6803
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6804
indicationValue:aValue
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  6805
    "set the indication value
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6806
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6807
    |numArgs recv|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6808
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6809
    indication isNil ifTrue:[^ self].                                   "no indication specified"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6810
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6811
    indication isSymbol ifFalse:[                                       
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6812
        indication perform:#value: with:aValue ifNotUnderstood:nil.     "block or model"
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6813
        ^ self
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6814
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6815
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6816
    (numArgs := indication numArgs) == 0 ifTrue:[                       "no arguments to selector; cannot set"
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6817
        ^ self
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  6818
    ].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  6819
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6820
    recv := menuPanel receiver.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6821
    recv isValueModel ifTrue:[^ self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6822
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  6823
    recv isNil ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6824
        recv := menuPanel application.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6825
        recv isNil ifTrue:[^ self].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6826
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6827
2069
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  6828
    MessageNotUnderstood handle:[:ex| 
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6829
        (ex message selector ~~ indication) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6830
            ex reject
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6831
        ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6832
        self ifNotInUIBuilderInfoPrintCR:
2545
e838be7f2c83 Tell application name in info message about no-existing aspects.
Stefan Vogel <sv@exept.de>
parents: 2505
diff changeset
  6833
            ('MenuPanel::Item [info]: application (class %1) does not respond to: %2' 
e838be7f2c83 Tell application name in info message about no-existing aspects.
Stefan Vogel <sv@exept.de>
parents: 2505
diff changeset
  6834
             bindWith:recv className with:indication).
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6835
    ] do:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6836
        numArgs == 1 ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6837
            recv perform:indication with:aValue
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6838
        ] ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6839
            recv perform:indication with:(menuItem argument ? self) with:aValue
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6840
        ]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6841
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6842
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6843
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6844
indicatorForm
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6845
    "returns indication form or nil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6846
    "
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  6847
    |val|
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  6848
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6849
    indication isNil ifTrue:[^ nil].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6850
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  6851
    val := self indicationValue.
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  6852
    self enabled ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6853
	^ val == true 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6854
	    ifTrue:[menuPanel iconIndicationDisabledOn]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6855
	    ifFalse:[menuPanel iconIndicationDisabledOff]
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  6856
    ].
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  6857
    ^ val == true 
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6858
	ifTrue:[menuPanel iconIndicationOn]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6859
	ifFalse:[menuPanel iconIndicationOff]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6860
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6861
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6862
isEntered
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6863
    "returns true if the mouse pointer is over the item
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6864
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6865
    ^ menuPanel enteredItem == self
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6866
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6867
    "Created: / 20.8.1998 / 13:11:50 / cg"
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6868
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6869
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  6870
separatorType
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  6871
    "returns type of separator line or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6872
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6873
    |c lbl|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6874
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6875
    self isSeparator ifFalse:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6876
        ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6877
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6878
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6879
    (lbl := label value) isNil ifTrue:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6880
        ^ #singleLine
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6881
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6882
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6883
    lbl size == 1 ifTrue:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6884
        c := lbl first.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6885
        c == $- ifTrue:[^ #singleLine].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6886
        c == $= ifTrue:[^ #doubleLine].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6887
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6888
    ^ #blankLine
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  6889
!
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  6890
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  6891
setupSubmenu
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6892
    |appl master recv submenuHolder submenu submenuEncoding channel|
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6893
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6894
    channel := menuItem submenuChannel value.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6895
    channel isNil ifTrue:[ ^ subMenu ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6896
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6897
    subMenu notNil ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6898
        menuItem keepLinkedMenu ifTrue:[ ^ subMenu ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6899
    ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6900
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6901
    channel isSymbol ifFalse:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6902
        submenuHolder := channel
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6903
    ] ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6904
        appl := menuPanel application.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6905
        appl isNil ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6906
            appl := menuPanel receiver.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6907
            appl notNil ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6908
                (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6909
                    [submenuHolder isNil 
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6910
                     and:[(master := appl perform:#masterApplication ifNotUnderstood:nil) notNil
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6911
                          and:[master ~~ appl]]] whileTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6912
                        appl := master.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6913
                        submenuHolder := self findSubMenuIn:appl.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6914
                    ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6915
                ]
2232
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  6916
            ].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6917
        ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6918
        submenuHolder isNil ifTrue:[    
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6919
            (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6920
                (recv := menuPanel receiver) ~~ appl ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6921
                    appl := recv.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6922
                    submenuHolder := self findSubMenuIn:appl
2232
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  6923
                ]
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  6924
            ]
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6925
        ]
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6926
    ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6927
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6928
    (submenu := submenuHolder value) isArray ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6929
        submenuEncoding := submenu.    
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6930
        submenu := Menu new fromLiteralArrayEncoding:submenuEncoding.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6931
        "/ cg: linked menus also may contain translations ...
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6932
        submenu notNil ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6933
            appl notNil ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6934
                submenu findGuiResourcesIn:appl.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6935
            ]                
2232
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  6936
        ].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6937
    ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6938
    "/ appl notNil ifTrue:[submenu application:appl].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6939
    self submenu:submenu.
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  6940
    ^ subMenu
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  6941
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  6942
    "Modified: / 19.5.1998 / 19:36:56 / cg"
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6943
!
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6944
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6945
spaceBetweenEmptyLines
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6946
        ^ 3
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6947
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6948
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6949
!MenuPanel::Item methodsFor:'queries'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6950
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  6951
canChangeVisibility
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6952
    "return true if I am not always visible; can only be changed by a selector
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6953
     otherwise there is a change notification raised if the model changed
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6954
    "
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6955
    ^ isVisible isSymbol
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6956
"/  ^ isVisible notNil and:[isVisible ~~ true]
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  6957
!
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  6958
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6959
canSelect
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6960
    "returns true if item is selectable; no separator, visible and enabled.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6961
     in case of a choice (RadioButton) i have to check for the choiceValue
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6962
    "
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6963
    self isSeparator ifTrue:[^ false].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6964
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6965
    (self isVisible and:[self enabled]) ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6966
        (choice isNil or:[choice value ~= menuItem choiceValue]) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6967
            ^ true
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6968
        ].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  6969
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  6970
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6971
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6972
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  6973
containsPoint:aPoint
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  6974
    "returns true if aPoint is contained in my layout
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  6975
    "
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  6976
    (self isVisible and:[layout notNil]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6977
	^ layout containsPoint:aPoint
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  6978
    ].
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  6979
    ^ false
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  6980
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  6981
    "Created: / 13.11.2001 / 13:55:31 / cg"
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  6982
!
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  6983
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6984
containsPointX:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6985
    "returns true if point is contained in my layout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6986
    "
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6987
    (self isVisible and:[layout notNil]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6988
	^ layout containsPointX:x y:y
505
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  6989
    ].
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  6990
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6991
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6992
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6993
hasDelayedMenu
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6994
    "returns true if a delayed menu exists
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6995
    "
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6996
    self hasSubmenu ifFalse:[
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6997
        ^ false
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6998
    ].
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6999
    menuItem itemValue notNil ifTrue:[ ^ true ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  7000
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  7001
    (indication isNil and:[choice isNil]) ifTrue:[
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  7002
        ^ false
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7003
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7004
    ^ true
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7005
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7006
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7007
hasDelayedMenuIndicator
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7008
    "returns true if the item has a delayed menu
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  7009
     and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7010
    "
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7011
    menuPanel isPopUpView ifFalse:[
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7012
        ^ self hasDelayedMenu
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7013
    ].
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7014
    ^ false
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7015
!
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7016
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7017
hasIndication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7018
    "returns true if on/off indication exists
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7019
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7020
    ^ indication notNil
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7021
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7022
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7023
hasMenuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7024
    "returns true if the item has a delayed menu
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7025
     and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7026
    "
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7027
    menuPanel isPopUpView ifFalse:[
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  7028
        ^ self hasSubmenu and:[menuItem isButton]
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7029
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7030
    ^ false
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7031
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7032
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7033
hasSubmenu
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  7034
    "returns true if the item is configured as an subMenu entry
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7035
    "
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7036
    ^ subMenu notNil or:[menuItem submenuChannel notNil]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7037
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7038
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7039
isEnabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7040
    "returns enabled state
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7041
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7042
    ^ self enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7043
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7044
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7045
isSeparator
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7046
    "returns true if item is a separator
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7047
    "
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7048
    ^ displayLabel isNil
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7049
!
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7050
2159
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  7051
isToggle
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  7052
    "returns true if on/off indication exists
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  7053
    "
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  7054
    ^ self hasIndication and:[ self isButton ]
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  7055
!
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  7056
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7057
isVisible
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7058
    "returns the visibility state
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7059
    "
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7060
    |state|
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7061
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7062
    isVisible isSymbol ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7063
	state := self aspectAt:isVisible.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7064
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7065
	state isValueModel ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7066
	    isVisible := state.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7067
	    isVisible addDependent:self.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7068
	    state := isVisible.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7069
	]
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7070
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7071
	state := isVisible
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  7072
    ].
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  7073
  ^ state value ~~ false
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  7074
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  7075
    "Modified: / 5.10.1998 / 12:08:28 / cg"
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7076
!
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7077
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7078
isVisible:something
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7079
    "change the state; if the state changed, a redraw is performed
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7080
    "
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7081
    |oldState newState|
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7082
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7083
    isVisible isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7084
	oldState := true
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7085
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7086
	oldState := isVisible value.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7087
	isVisible isValueModel ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7088
	    isVisible removeDependent:self
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7089
	]
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7090
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7091
    isVisible := something.
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7092
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7093
    isVisible isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7094
	newState := true
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7095
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7096
	isVisible isValueModel ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7097
	    isVisible addDependent:self
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7098
	] ifFalse:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7099
	    isVisible isSymbol ifTrue:[^ self]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7100
	].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7101
	menuPanel shown ifFalse:[^ self].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7102
	newState := isVisible value.
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7103
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7104
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7105
    newState ~~ oldState ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7106
	menuPanel mustRearrange
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7107
    ]
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  7108
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  7109
    "Modified: / 5.10.1998 / 12:12:04 / cg"
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7110
!
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7111
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7112
needsItemSpaceWhenDrawing
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7113
    ^ self isSeparator not and:[menuItem isButton not]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7114
!
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7115
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7116
shortcutKeyAsString
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7117
    "converts shortcutKey to a text object
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7118
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7119
    |nm prefix shortcutKey|
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7120
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7121
    shortcutKey := menuItem shortcutKey.
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  7122
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  7123
    shortcutKey isNil ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7124
        ^ nil
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  7125
    ].
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  7126
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  7127
    shortcutKey isCharacter ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7128
        nm := shortcutKey asString
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7129
    ] ifFalse:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7130
        "/ this is somewhat complicated: we have the symbolic key at hand,
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7131
        "/ but want to show the untranslated (inverse keyBoardMapped) key & modifier
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7132
        "/ Ask the devices keyboardMap for the backtranslation.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7133
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7134
        nm := menuPanel device keyboardMap keyAtValue:shortcutKey ifAbsent:shortcutKey.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7135
        "/
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7136
        "/ some modifier-key combination ?
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7137
        "/
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7138
        (nm startsWith:#Cmd) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7139
            prefix := #Cmd.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7140
        ] ifFalse:[(nm startsWith:#Alt) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7141
            prefix := #Alt.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7142
        ] ifFalse:[(nm startsWith:#Meta) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7143
            prefix := #Meta.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7144
        ] ifFalse:[(nm startsWith:#Ctrl) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7145
            prefix := #Ctrl.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7146
        ]]]].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7147
        prefix notNil ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7148
            nm := (self shortcutKeyPrefixFor:prefix), (nm copyFrom:(prefix size + 1))
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7149
        ] ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7150
            nm := nm asString
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7151
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7152
    ].
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7153
    ^ nm
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7154
987
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  7155
    "Modified: / 17.7.1998 / 11:56:40 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7156
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7157
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7158
shortcutKeyPrefixFor:aModifier
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7159
    "returns prefix assigned to a modifier
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7160
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7161
    |m|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7162
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7163
    m := menuPanel device modifierKeyTopFor:aModifier.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7164
    m notNil ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  7165
	^ m , '-'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7166
    ].
987
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  7167
    ^ aModifier , '-'.
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  7168
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  7169
    "Modified: / 17.7.1998 / 11:56:46 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7170
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7171
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7172
!MenuPanel::Item methodsFor:'selection'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7173
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7174
isSelected
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7175
    "returns true if item is selected
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7176
    "
1998
5059b7c9cd2c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1997
diff changeset
  7177
5059b7c9cd2c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1997
diff changeset
  7178
    ^ menuPanel notNil and:[menuPanel selection == self]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7179
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7180
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7181
isSelected:isSelected
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  7182
    "change selection to a state. Dependant on the state open or hide an existing
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  7183
     submenu and perform a redraw
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  7184
    "
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7185
    (isSelected and:[menuPanel notNil]) ifFalse:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7186
        self invalidate.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7187
        self hideSubmenu.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7188
        ^ self
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7189
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7190
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7191
    menuPanel realized ifFalse:[ ^ self ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7192
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7193
    (indication isNil or:[menuItem isButton not]) ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7194
        self invalidate
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7195
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7196
    self hasSubmenu ifFalse:[ ^ self].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7197
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7198
    self hasDelayedMenu ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7199
        menuPanel openDelayed:self
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7200
    ] ifFalse:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7201
        subMenu := self setupSubmenu.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  7202
        subMenu notNil ifTrue:[ self openSubmenu ].
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7203
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7204
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7205
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7206
!MenuPanel::ScrollActivity class methodsFor:'default icons'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7207
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7208
icon
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7209
    "This resource specification was automatically generated
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7210
     by the ImageEditor of ST/X."
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7211
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7212
    "Do not manually edit this!! If it is corrupted,
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7213
     the ImageEditor may not be able to read the specification."
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7214
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7215
    "
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7216
     self icon inspect
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7217
     ImageEditor openOnClass:self andSelector:#icon
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7218
    "
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7219
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7220
    <resource: #image>
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7221
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7222
    ^Icon
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7223
	constantNamed:#'MenuPanel::Scrolling class icon'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7224
	ifAbsentPut:[(Depth1Image new) width: 11; height: 11; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?>@@@@@@ @C@@N@@<@C8@O<@@@@@@@@a') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 11; height: 11; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@_<@? A<@C @D@@@@@@@@@@@a') ; yourself); yourself]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7225
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7226
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7227
!MenuPanel::ScrollActivity class methodsFor:'instance creation'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7228
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7229
new
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7230
    ^ self basicNew initialize
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7231
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7232
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7233
!MenuPanel::ScrollActivity methodsFor:'accessing'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7234
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7235
activeMenu
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7236
    "returns the active menu the scrolling is activated on; nil
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7237
     is returned if scrolling is deactivated
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7238
    "
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7239
    ^ activeMenu
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7240
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7241
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7242
direction
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7243
    "returns the scroll-direction
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7244
    "
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7245
    ^ direction
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7246
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7247
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7248
iconAt:aDirection on:aMenu
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7249
    |icon device index|
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7250
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7251
    device := aMenu device.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7252
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7253
    aDirection == #PREV ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7254
	aMenu verticalLayout ifTrue:[index := 3]    "/ 3 - 1 * 90  180
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7255
			    ifFalse:[index := 2]    "/ 2 - 1 * 90  90   
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7256
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7257
	aMenu verticalLayout ifTrue:[index := 1]    "/ 1 - 1 * 90  0
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7258
			    ifFalse:[index := 4]    "/ 4 - 1 * 90  270
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7259
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7260
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7261
    icon := icons at:index.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7262
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7263
    (icon isNil or:[icon device ~~ device]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7264
	icon := self class icon.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7265
	index > 1 ifTrue:[ icon := icon rotated:(index - 1 * 90) ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7266
		 ifFalse:[ icon := icon copy ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7267
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7268
	icon := icon onDevice:device.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7269
	icon clearMaskedPixels.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7270
	icons at:index put:icon
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7271
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7272
    ^ icon
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7273
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7274
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7275
!MenuPanel::ScrollActivity methodsFor:'initialization'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7276
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7277
initialize
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7278
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7279
    semaLock := RecursionLock new.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7280
    icons    := Array new:4.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7281
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7282
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7283
!MenuPanel::ScrollActivity methodsFor:'queries'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7284
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7285
isActive
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7286
    "returns true if scrolling is activated
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7287
    "
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7288
    ^ activeMenu notNil
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7289
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7290
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7291
!MenuPanel::ScrollActivity methodsFor:'user operations'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7292
2047
62de65e3a61b initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents: 2046
diff changeset
  7293
startIfRequiredAt:aDirection on:aMenu
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7294
    "start scrolling; returns true if scrolling is activated
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7295
    "
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7296
    |bounds index|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7297
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7298
    semaLock critical:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7299
	self stop.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7300
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7301
	(     aDirection notNil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7302
	 and:[aMenu notNil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7303
	 and:[(bounds := aMenu scrollerBoundsAt:aDirection) notNil]]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7304
	) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7305
	    activeMenu := aMenu.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7306
	    direction  := aDirection.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7307
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7308
	    index := aMenu indexOfItemAtScroller:aDirection.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7309
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7310
	    index ~~ 0 ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7311
		scrollTask := 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7312
		    [ 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7313
			|item step|
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7314
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7315
			[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7316
			    step := (aDirection == #PREV) ifTrue:[-1] ifFalse:[1].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7317
			    ( aMenu shown and:[(item := aMenu itemAt:index) notNil] ) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7318
				aMenu makeItemVisible:item.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7319
				index := index + step.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7320
			    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7321
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7322
			    Delay waitForSeconds:(ButtonController defaultInitialDelay).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7323
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7324
			    [ aMenu shown and:[(item := aMenu itemAt:index) notNil] ] whileTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7325
				aMenu makeItemVisible:item.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7326
				Delay waitForSeconds:(ButtonController defaultRepeatDelay).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7327
				index := index + step.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7328
			    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7329
			    item := nil.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7330
			] ensure:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7331
			    scrollTask := nil.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7332
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7333
			    item notNil ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7334
				"/ process was killed
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7335
				aMenu invalidate:bounds
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7336
			    ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7337
			]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7338
		    ] forkAt:8.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7339
	    ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7340
	]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7341
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7342
    ^ bounds notNil
2047
62de65e3a61b initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents: 2046
diff changeset
  7343
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  7344
    "Created: ca"
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  7345
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  7346
    "Modified: / 13.11.2001 / 20:15:52 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7347
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7348
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7349
stop
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7350
    "stop scrolling; returns true if the scrolling was activated otherwise false
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7351
    "
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7352
    |task resp|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7353
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7354
    activeMenu isNil ifTrue:[
2231
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7355
        ^ false
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7356
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7357
    semaLock critical:[
2231
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7358
        resp := activeMenu notNil.
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7359
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7360
        (task := scrollTask) notNil ifTrue:[
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7361
            scrollTask := nil.
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7362
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7363
            Error handle:[:ex|
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7364
            ] do:[
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7365
                task terminateWithAllSubprocessesInGroup.
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7366
                task waitUntilTerminated.
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7367
            ].
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7368
        ].
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7369
        activeMenu := direction := nil.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7370
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7371
    ^ resp
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7372
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7373
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7374
!MenuPanel class methodsFor:'documentation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7375
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7376
version
2545
e838be7f2c83 Tell application name in info message about no-existing aspects.
Stefan Vogel <sv@exept.de>
parents: 2505
diff changeset
  7377
    ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.369 2003-08-08 08:11:09 stefan Exp $'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7378
! !
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7379
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7380
MenuPanel initialize!