MenuPanel.st
author ca
Tue, 30 Jan 2001 19:49:20 +0100
changeset 1923 530426a3d692
parent 1922 1a2ab52eb2ab
child 1929 58586354e428
permissions -rw-r--r--
support #level:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
     1
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
     2
 COPYRIGHT (c) 1997 by eXept Software AG
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
     3
	      All Rights Reserved
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
     4
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
     5
 This software is furnished under a license and may be used
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    10
 hereby transferred.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    11
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    12
dce33f8bb806 intitial checkin
ca
parents:
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
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
    16
SimpleView subclass:#MenuPanel
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    17
	instanceVariableNames:'adornment shadowView mapTime mustRearrange superMenu
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    18
		shortKeyInset selection items groupSizes receiver enableChannel
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    19
		menuHolder enabled onLevel offLevel fgColor activeFgColor
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    20
		lastActiveMenu activeBgColor disabledFgColor groupDividerSize
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
    21
		itemSpace fitFirstPanel rightArrow rightArrowShadow
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
    22
		selectionFrameBrightColor selectionFrameDarkColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
    23
		buttonLightColor buttonShadowColor buttonHalfLightColor
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
    24
		buttonHalfShadowColor enteredItem buttonEnteredBgColor
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
    25
		prevFocusView previousPointerGrab previousKeyboardGrab
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
    26
		relativeGrabOrigin hasImplicitGrap iconIndicationOff
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
    27
		iconIndicationOn iconRadioGroupOff iconRadioGroupOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
    28
		iconIndicationDisabledOff iconIndicationDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
    29
		iconRadioGroupDisabledOff iconRadioGroupDisabledOn'
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
    30
	classVariableNames:'InitialSelectionQuerySignal DefaultAdornment ShortcutKeyOffset
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    31
		DefaultGroupDividerSize DefaultHilightLevel DefaultLevel
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
    32
		DefaultItemSpace DefaultButtonItemSpace DefaultForegroundColor
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
    33
		DefaultBackgroundColor DefaultHilightForegroundColor
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
    34
		DefaultHilightBackgroundColor DefaultDisabledForegroundColor
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
    35
		DefaultEnteredLevel DefaultSelectionFollowsMouse
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    36
		DefaultOpenOnSelect DefaultFitFirstPanel RightArrowForm
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    37
		RightArrowShadowForm SelectionFrameBrightColor
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    38
		SelectionFrameDarkColor ButtonActiveLevel ButtonPassiveLevel
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    39
		ButtonActiveBackgroundColor ButtonPassiveBackgroundColor
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    40
		ButtonLightColor ButtonShadowColor ButtonHalfLightColor
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    41
		ButtonHalfShadowColor ButtonEdgeStyle Images LigthenedImages
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    42
		ButtonEnteredBackgroundColor ButtonEnteredLevel'
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    43
	poolDictionaries:''
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    44
	category:'Views-Menus'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    45
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    46
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    47
Object subclass:#Item
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
    48
	instanceVariableNames:'layout menuPanel subMenu rawLabel rawLabelExtent disabledRawLabel
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
    49
		enableChannel nameKey value label activeHelpKey activeHelpText
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
    50
		submenuChannel startGroup isButton isVisible hideMenuOnActivated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
    51
		indication accessCharacterPosition shortcutKey argument choice
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
    52
		choiceValue showBusyCursorWhilePerforming accessCharacter font
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
    53
		keepLinkedMenu triggerOnDown'
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    54
	classVariableNames:'HorizontalInset VerticalInset HorizontalButtonInset
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
    55
		VerticalButtonInset LabelRightOffset VerticalPopUpInset'
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    56
	poolDictionaries:''
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    57
	privateIn:MenuPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    58
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    59
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    60
!MenuPanel class methodsFor:'documentation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    61
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    62
copyright
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    63
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    64
 COPYRIGHT (c) 1997 by eXept Software AG
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
    65
	      All Rights Reserved
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    66
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    67
 This software is furnished under a license and may be used
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    68
 only in accordance with the terms of that license and with the
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    69
 inclusion of the above copyright notice.   This software may not
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    70
 be provided or otherwise made available to, or used by, any
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    71
 other person.  No title to or ownership of the software is
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    72
 hereby transferred.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    73
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    74
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    75
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    76
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    77
documentation
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    78
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    79
    a menu panel used for both pull-down-menus and pop-up-menus.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    80
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    81
    not yet finished MenuPanel class - this will eventually replace
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    82
    most of the MenuView and PopUpMenu stuff.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    83
    (and hopefully be ST-80 compatible ...)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    84
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    85
    To create a menu, there exists a MenuEditor which will generate
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    86
    a menu specification.
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    87
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    88
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    89
DefaultSelectionFollowsMouse := true.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    90
DefaultSelectionFollowsMouse := false.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    91
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    92
    [author:]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    93
        Claus Atzkern
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    94
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    95
    [see also:]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    96
        Menu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    97
        MenuItem
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    98
        MenuEditor
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    99
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   100
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   101
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   102
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   103
examples
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   104
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   105
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   106
    start as PullDownMenu
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   107
                                                                                [exBegin]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   108
    |top subView mview desc s1 s2 s3 img lbs labels|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   109
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   110
    top := StandardSystemView new.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   111
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   112
    mview := MenuPanel in:top.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   113
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   114
    labels := #( 'foo' 'bar' 'baz' 'test' 'claus' ).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   115
    mview level:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   116
    mview verticalLayout:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   117
    img := Image fromFile:'bitmaps/SBrowser.xbm'.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   118
    lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test' with:'ludwig'.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   119
    mview labels:lbs.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   120
    mview shortcutKeyAt:2 put:#Cut.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   121
    mview accessCharacterPositionAt:1 put:1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   122
    mview accessCharacterPositionAt:2 put:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   123
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   124
    mview enabledAt:5 put:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   125
    mview groupSizes:#( 2 2 ).
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   126
    s1 := MenuPanel labels:labels.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   127
    s1 accessCharacterPositionAt:1 put:1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   128
    s1 accessCharacterPositionAt:2 put:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   129
    s1 groupSizes:#( 2 2 ).
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   130
    s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ).
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   131
    s3 := MenuPanel labels:lbs.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   132
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   133
    s1 subMenuAt:2 put:s2.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   134
    s1 subMenuAt:3 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   135
    s2 subMenuAt:3 put:s3.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   136
    s3 subMenuAt:3 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   137
    s3 shortcutKeyAt:3 put:$q.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   138
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   139
    mview subMenuAt:1 put:s1.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   140
    mview subMenuAt:4 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   141
    (mview subMenuAt:4) shortcutKeyAt:3 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   142
    s1 shortcutKeyAt:1 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   143
    s1 shortcutKeyAt:3 put:#Paste.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   144
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   145
    mview subMenuAt:2 put:(MenuPanel labels:labels).
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   146
    top extent:(mview preferredExtent).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   147
    top open.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   148
                                                                                [exEnd]
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   149
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   150
                                                                                [exBegin]
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   151
    |top menu view item|
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   152
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   153
    top  := StandardSystemView extent:240@100.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   154
    menu := MenuPanel in:top.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   155
    menu labels:#( 'foo' 'Application' 'Clock' ).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   156
    menu verticalLayout:false.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   157
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   158
    menu subMenuAt:1 put:(MenuPanel labels:#( 'bar' 'baz' )).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   159
    menu subMenuAt:2 put:(MenuPanel labels:#( 'foo' 'bar' 'baz' )).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   160
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   161
    view := ClockView new.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   162
    view preferredExtent:100@100.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   163
    item := menu itemAt:3.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   164
    item submenu:view.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   165
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   166
    view := SimpleView new.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   167
    view client:(CodingExamples_GUI::GUIDemoExtendedComboBox new).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   168
    view preferredExtent:(400@50).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   169
    item := menu itemAt:2.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   170
    item submenu:view.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   171
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   172
    menu origin:0@0 corner:1.0@30.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   173
    top open.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   174
                                                                                [exEnd]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   175
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   176
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   177
    start as PopUpMenu
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   178
                                                                                [exBegin]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   179
    |subView mview desc s1 s2 s3 img lbs labels|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   180
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   181
    mview := MenuPanel new.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   182
    labels := #( 'foo' 'bar' 'baz' ).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   183
    mview level:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   184
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   185
    img := Image fromFile:'bitmaps/SBrowser.xbm'.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   186
    lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test'.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   187
    mview labels:lbs.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   188
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   189
    s1 := MenuPanel labels:labels.
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   190
    s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ).
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   191
    s3 := MenuPanel labels:lbs.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   192
    s1 subMenuAt:2 put:s2.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   193
    s1 subMenuAt:3 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   194
    s2 subMenuAt:3 put:s3.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   195
    s3 subMenuAt:3 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   196
    s3 shortcutKeyAt:3 put:$q.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   197
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   198
    mview subMenuAt:1 put:s1.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   199
    mview subMenuAt:4 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   200
    (mview subMenuAt:4) shortcutKeyAt:3 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   201
    s1 shortcutKeyAt:1 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   202
    s1 shortcutKeyAt:3 put:#Paste.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   203
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   204
    mview subMenuAt:2 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   205
    mview startUp
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   206
                                                                                [exEnd]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   207
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   208
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   209
    start from menu spec
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   210
                                                                                [exBegin]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   211
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   212
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   213
    menu := MenuPanel menu:
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   214
        #(#Menu #( #(#MenuItem 
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   215
                    #label: 'File' 
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   216
                    #submenu:
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   217
                      #(#Menu #(#(#MenuItem #label: 'quit' #value:#quit )     
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   218
                                 (#MenuItem 
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   219
                                    #label: 'edit' 
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   220
                                    #submenu:
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   221
                                      #(#Menu #( #(#MenuItem #label: 'edit'  #value:#edit )     
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   222
                                                 #(#MenuItem #label: 'close' #value:#close)     
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   223
                                               )
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   224
                                               nil
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   225
                                               nil
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   226
                                       )     
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   227
                                  )
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   228
                                 #(#MenuItem #label: 'help' #value:#help )     
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   229
                               )
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   230
                               nil
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   231
                               nil
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   232
                       )     
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   233
                 ) 
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   234
                #(#MenuItem #label: 'Inspect' #value:#inspectMenu ) 
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   235
                #(#MenuItem #label: 'Bar' 
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   236
                            #submenu:
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   237
                               #(#Menu #( #(#MenuItem #label: 'bar 1' #value:#bar1 )     
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   238
                                          #(#MenuItem #label: 'bar 2' #value:#bar2 )     
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   239
                                        )
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   240
                                        nil
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   241
                                        nil
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   242
                                )     
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   243
                 ) 
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   244
              ) 
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   245
              #( 2 )
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   246
              nil
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   247
         ) decodeAsLiteralArray.  
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   248
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   249
    menu verticalLayout:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   250
    Transcript showCR:(menu startUp).
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   251
                                                                                [exEnd]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   252
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   253
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   254
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   255
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   256
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   257
!MenuPanel class methodsFor:'instance creation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   258
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   259
fromSpec:aSpec
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   260
    ^ self fromSpec:aSpec receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   261
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   262
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   263
fromSpec:aSpec receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   264
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   265
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   266
    aSpec notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   267
	menu := Menu new.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   268
	menu fromLiteralArrayEncoding:aSpec.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   269
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   270
  ^ self menu:menu receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   271
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   272
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   273
labels:labels
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   274
    ^ self labels:labels nameKeys:nil receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   275
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   276
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   277
labels:labels nameKeys:nameKeys
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   278
    ^ self labels:labels nameKeys:nameKeys receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   279
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   280
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   281
labels:labels nameKeys:nameKeys receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   282
    |mview|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   283
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   284
    mview := self menu:nil receiver:aReceiver.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   285
    mview labels:labels.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   286
    mview nameKeys:nameKeys.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   287
  ^ mview
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   288
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   289
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   290
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   291
labels:labels receiver:aReceiver
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   292
    ^ self labels:labels nameKeys:nil receiver:aReceiver
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   293
!
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   294
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   295
menu:aMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   296
    ^ self menu:aMenu receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   297
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   298
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   299
menu:aMenu receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   300
    |mview|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   301
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   302
    mview := self new.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   303
    mview menu:aMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   304
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   305
"/ a menu itself may contain a receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   306
"/ thus we do not overwrite the receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   307
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   308
    aReceiver notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   309
	mview receiver:aReceiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   310
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   311
  ^ mview
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   312
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   313
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   314
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   315
!MenuPanel class methodsFor:'class initialization'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   316
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   317
initialize
657
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   318
    "
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   319
    DefaultAdornment := nil.
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   320
    self initialize
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   321
    "
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   322
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   323
    InitialSelectionQuerySignal isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   324
	InitialSelectionQuerySignal := QuerySignal new.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   325
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   326
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   327
    DefaultAdornment isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   328
	DefaultAdornment := IdentityDictionary new
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   329
	    at:#showSeparatingLines put:false;
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   330
	    at:#showGroupDivider    put:true;
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   331
	    at:#verticalLayout      put:true;
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   332
	    at:#item                put:nil;
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   333
	    at:#value               put:nil;
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   334
	    yourself
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   335
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   336
660
d1670dfe5445 Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents: 658
diff changeset
   337
    "Modified: / 15.1.1998 / 23:08:31 / stefan"
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   338
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   339
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   340
preSnapshot
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   341
    "remove all resources
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   342
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   343
    Images := nil.
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   344
    LigthenedImages := nil.
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   345
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   346
! !
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   347
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   348
!MenuPanel class methodsFor:'default icons'!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   349
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   350
iconIndicationDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   351
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   352
     by the ImageEditor of ST/X."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   353
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   354
    "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
   355
     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
   356
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
     self iconIndicationDisabledOff inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   359
     ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOff
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
    <resource: #image>
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   363
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   364
    ^Icon
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   365
        constantNamed:#'MenuPanel iconIndicationDisabledOff'
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   366
        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]
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   367
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   368
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   369
iconIndicationDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   370
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   371
     by the ImageEditor of ST/X."
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
    "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
   374
     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
   375
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
     self iconIndicationDisabledOn inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   378
     ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOn
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
    <resource: #image>
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   382
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   383
    ^Icon
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   384
        constantNamed:#'MenuPanel iconIndicationDisabledOn'
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   385
        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]
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   386
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   387
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   388
iconIndicationOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   389
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   390
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   391
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   392
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   393
     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
   394
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
     self iconIndicationOff inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   397
     ImageEditor openOnClass:self andSelector:#iconIndicationOff
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
    <resource: #image>
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   401
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   402
    ^Icon
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   403
        constantNamed:#'MenuPanel iconIndicationOff'
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   404
        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]
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   405
!
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   406
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   407
iconIndicationOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   408
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   409
     by the ImageEditor of ST/X."
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
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   412
     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
   413
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
     self iconIndicationOn inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   416
     ImageEditor openOnClass:self andSelector:#iconIndicationOn
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
    <resource: #image>
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   420
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   421
    ^Icon
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   422
        constantNamed:#'MenuPanel iconIndicationOn'
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   423
        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]
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   424
!
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   425
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   426
iconRadioGroupDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   427
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   428
     by the ImageEditor of ST/X."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   429
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   430
    "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
   431
     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
   432
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
     self iconRadioGroupDisabledOff inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   435
     ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOff
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
    <resource: #image>
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   439
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   440
    ^Icon
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   441
        constantNamed:#'MenuPanel iconRadioGroupDisabledOff'
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   442
        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]
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   443
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   444
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   445
iconRadioGroupDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   446
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   447
     by the ImageEditor of ST/X."
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
    "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
   450
     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
   451
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
     self iconRadioGroupDisabledOn inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   454
     ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOn
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
    <resource: #image>
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   458
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   459
    ^Icon
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   460
        constantNamed:#'MenuPanel iconRadioGroupDisabledOn'
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   461
        ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@AUP@@E@AP@DJ*Y@DY@Z(AH@@+AI@@FLR@@@#D @@H1H@@BLRP@A#AX@@#@Z$A(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]
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   462
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   463
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   464
iconRadioGroupOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   465
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   466
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   467
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   468
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   469
     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
   470
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   471
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   472
     self iconRadioGroupOff inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   473
     ImageEditor openOnClass:self andSelector:#iconRadioGroupOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   474
    "
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
    <resource: #image>
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   477
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   478
    ^Icon
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   479
        constantNamed:#'MenuPanel iconRadioGroupOff'
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   480
        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]
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   481
!
1726
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
iconRadioGroupOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   484
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   485
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   486
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   487
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   488
     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
   489
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   490
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   491
     self iconRadioGroupOn inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   492
     ImageEditor openOnClass:self andSelector:#iconRadioGroupOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   493
    "
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
    <resource: #image>
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   496
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   497
    ^Icon
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   498
        constantNamed:#'MenuPanel iconRadioGroupOn'
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   499
        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]
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   500
! !
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   501
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   502
!MenuPanel class methodsFor:'defaults'!
450
ac72eb2ed895 initialize fix
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   503
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   504
mnemonicIdentifier
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   505
    "returns the identifier each mnemonic starts with;
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   506
     ex:
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   507
        &File   mnemonic := Cmdf
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   508
        F&ile   mnemonic := Cmdi
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   509
        .....
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   510
    "
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   511
    ^ 'Cmd'
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   512
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   513
450
ac72eb2ed895 initialize fix
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   514
updateStyleCache
657
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   515
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   516
    <resource: #style (#'menu.foregroundColor' #'menu.backgroundColor'
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   517
                       #'menu.hilightForegroundColor' #'menu.disabledForegroundColor'
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   518
                       #'menu.hilightBackgroundColor' #'menu.buttonEnteredBackgroundColor'
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   519
                       #'menu.hilightLevel' #'menu.groupDividerSize'
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   520
                       #'menu.itemSpace' #'menu.buttonItemSpace'
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   521
                       #'menu.fitFirstPanel' #'menu.buttonActiveLevel'
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   522
                       #'menu.buttonPassiveLevel' #'menu.buttonEnteredLevel'
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   523
                       #'menu.selectionFollowsMouse' #'menu.enteredLevel'
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   524
                       #'viewBackground'
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   525
                       #'pullDownMenu.level' #'pullDownMenu.hilightLevel'
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   526
                       #'button.disabledForegroundColor' #'button.enteredBackgroundColor'
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   527
                       #'button.activeBackgroundColor' #'button.backgroundColor'
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   528
                       #'button.lightColor' #'button.shadowColor'
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   529
                       #'button.halfLightColor' #'button.halfShadowColor'
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   530
                       #'button.passiveLevel' #'button.activeLevel'
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   531
                       #'button.edgeStyle')>
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   532
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   533
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   534
    |style styleSheet|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   535
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   536
    styleSheet := StyleSheet.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   537
    style      := styleSheet name.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   538
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   539
    DefaultForegroundColor := styleSheet colorAt:#'menu.foregroundColor'
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   540
                                         default:Color black.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   541
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   542
    DefaultBackgroundColor := styleSheet colorAt:#'menu.backgroundColor'
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   543
                                         default:DefaultViewBackgroundColor.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   544
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   545
    DefaultHilightForegroundColor := styleSheet colorAt:#'menu.hilightForegroundColor'.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   546
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   547
    DefaultHilightForegroundColor isNil ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   548
        styleSheet is3D ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   549
            DefaultHilightForegroundColor := DefaultForegroundColor.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   550
        ] ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   551
            DefaultHilightForegroundColor := DefaultBackgroundColor.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   552
        ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   553
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   554
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   555
    DefaultDisabledForegroundColor := styleSheet colorAt:#'menu.disabledForegroundColor'.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   556
    DefaultDisabledForegroundColor isNil ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   557
        DefaultDisabledForegroundColor := styleSheet colorAt:#'button.disabledForegroundColor'
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   558
                                                     default:Color darkGray.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   559
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   560
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   561
    DefaultHilightBackgroundColor := styleSheet colorAt:#'menu.hilightBackgroundColor'.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   562
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   563
    DefaultHilightBackgroundColor isNil ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   564
        style == #motif ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   565
            DefaultHilightBackgroundColor := DefaultBackgroundColor
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   566
        ] ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   567
            DefaultHilightBackgroundColor := styleSheet is3D ifFalse:[DefaultForegroundColor]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   568
                                                              ifTrue:[DefaultBackgroundColor]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   569
        ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   570
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   571
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   572
    DefaultLevel := styleSheet at:#'pullDownMenu.level' default:0.
1337
f0ed36b3c3d6 style fixes
Claus Gittinger <cg@exept.de>
parents: 1336
diff changeset
   573
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   574
    (style == #motif or:[style == #iris]) ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   575
        DefaultHilightLevel := 2.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   576
        DefaultLevel        := DefaultLevel + 1.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   577
    ] ifFalse:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   578
        (DefaultHilightLevel    := styleSheet at:'pullDownMenu.hilightLevel') isNil ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   579
            DefaultHilightLevel := styleSheet at:'menu.hilightLevel' default:0.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
   580
        ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   581
        styleSheet is3D ifTrue:[DefaultLevel := DefaultLevel + 1].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   582
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   583
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   584
    DefaultGroupDividerSize := styleSheet at:#'menu.groupDividerSize' default:6.
1723
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
   585
    DefaultItemSpace        := styleSheet at:#'menu.itemSpace' default:2.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   586
    DefaultButtonItemSpace  := styleSheet at:#'menu.buttonItemSpace' default:0.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   587
    DefaultFitFirstPanel    := styleSheet at:#'menu.fitFirstPanel' default:true.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   588
829
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
   589
    MenuView updateStyleCache.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   590
    DefaultFont    := MenuView defaultFont.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   591
    RightArrowForm := SelectionInListView rightArrowFormOn:Display.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   592
1054
f56416a8d26b win95 has no 3D right-arrow for subMenus.
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
   593
    (style ~~ #os2 and:[style ~~ #win95]) ifTrue:[
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
   594
        RightArrowShadowForm := SelectionInListView rightArrowShadowFormOn:Display.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   595
    ] ifFalse:[
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
   596
        RightArrowShadowForm := nil
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   597
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   598
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
   599
    SelectionFrameBrightColor    := Color white.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
   600
    SelectionFrameDarkColor      := Color black.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
   601
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   602
    ButtonActiveLevel            :=  styleSheet at:#'menu.buttonActiveLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]).
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   603
    ButtonActiveLevel isNil ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   604
        ButtonActiveLevel        :=  styleSheet at:#'button.activeLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]).
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   605
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   606
    ButtonPassiveLevel           :=  styleSheet at:#'menu.buttonPassiveLevel'.
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   607
    ButtonPassiveLevel isNil ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   608
        ButtonPassiveLevel       :=  styleSheet at:#'button.passiveLevel' default:(styleSheet is3D ifTrue:[2] ifFalse:[0]).
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   609
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   610
    ButtonActiveBackgroundColor  :=  styleSheet at:#'button.activeBackgroundColor' default: DefaultBackgroundColor.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   611
    ButtonPassiveBackgroundColor := (styleSheet at:#'button.backgroundColor') ? (styleSheet at:'viewBackground') ? DefaultBackgroundColor.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   612
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   613
    ButtonLightColor             := styleSheet at:#'button.lightColor'.
1336
6087005f59a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1332
diff changeset
   614
    ButtonLightColor isNil ifTrue:[
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
   615
        ButtonLightColor := (ButtonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) lightened. "/ Color white
1336
6087005f59a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1332
diff changeset
   616
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   617
    ButtonShadowColor            :=  styleSheet at:#'button.shadowColor'.
1336
6087005f59a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1332
diff changeset
   618
    ButtonShadowColor isNil ifTrue:[
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
   619
        ButtonShadowColor := (ButtonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) darkened. "/ Color white
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   620
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   621
    ButtonHalfLightColor         :=  styleSheet at:#'button.halfLightColor'.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   622
    ButtonHalfShadowColor        :=  styleSheet at:#'button.halfShadowColor'.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   623
    ButtonEdgeStyle              :=  styleSheet at:#'button.edgeStyle'.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   624
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   625
    ButtonEnteredBackgroundColor := styleSheet colorAt:#'menu.buttonEnteredBackgroundColor'.
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   626
    ButtonEnteredBackgroundColor isNil ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   627
        ButtonEnteredBackgroundColor := styleSheet colorAt:#'button.enteredBackgroundColor'
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
   628
                                                  default:ButtonPassiveBackgroundColor.
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   629
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   630
    ButtonEnteredLevel := styleSheet at:#'menu.buttonEnteredLevel' default:ButtonPassiveLevel.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   631
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   632
    DefaultSelectionFollowsMouse := styleSheet at:#'menu.selectionFollowsMouse' default:false.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   633
    DefaultEnteredLevel          := styleSheet at:#'menu.enteredLevel'          default:0.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
   634
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   635
    ShortcutKeyOffset            := 5.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   636
    DefaultOpenOnSelect := styleSheet at:#'menu.openOnSelect' default:false.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   637
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   638
    Item updateStyleCache
1018
67c883ab05d6 kludge fixes for normal style.
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
   639
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   640
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   641
     self updateStyleCache
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   642
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   643
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   644
    "Modified: / 10.9.1998 / 21:40:32 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   645
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   646
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   647
!MenuPanel class methodsFor:'image registration'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   648
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   649
image:anImage onDevice:aDevice
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   650
"
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   651
Images := nil
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   652
"
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   653
    |deviceImages image|
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   654
1156
6fa33dc93509 fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   655
    anImage device == aDevice ifTrue:[
1853
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   656
        ^ anImage
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   657
    ].
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   658
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   659
    Images isNil ifTrue:[ Images := WeakIdentityDictionary new ].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   660
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   661
    (deviceImages := Images at:aDevice ifAbsent:nil) isNil ifTrue:[
1853
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   662
        Images at:aDevice put:(deviceImages := Dictionary new)
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   663
    ].
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   664
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   665
    (image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[
1853
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   666
        ^ image
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   667
    ].
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
   668
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   669
    image := anImage copy onDevice:aDevice.
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   670
    image clearMaskedPixels.
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   671
    deviceImages at:anImage put:image.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   672
    ^ image
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   673
1156
6fa33dc93509 fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   674
    "Modified: / 29.9.1998 / 12:02:41 / cg"
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   675
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   676
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   677
lightenedImage:anImage onDevice:aDevice
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   678
"
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   679
LigthenedImages := nil
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   680
"
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   681
    |deviceImages image|
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   682
1853
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   683
    LigthenedImages isNil ifTrue:[ LigthenedImages := WeakIdentityDictionary new ].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   684
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   685
    (deviceImages := LigthenedImages at:aDevice ifAbsent:nil) isNil ifTrue:[
1853
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   686
        LigthenedImages at:aDevice put:(deviceImages := Dictionary new)
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   687
    ].
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   688
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   689
    (image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[
1853
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   690
        ^ image
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   691
    ].
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   692
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   693
    ((anImage respondsTo:#colorMap) and:[anImage colorMap notNil]) ifTrue:[
1853
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   694
        image := anImage copy lightened onDevice:aDevice.
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   695
        image clearMaskedPixels.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   696
    ] ifFalse:[
1853
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   697
        image := self image:anImage onDevice:aDevice
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   698
    ].
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   699
    deviceImages at:anImage put:image.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   700
    ^ image
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   701
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   702
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   703
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   704
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   705
!MenuPanel class methodsFor:'private'!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   706
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   707
subMenu:aSubMenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   708
    "create a submenu; can be redifined in derived classes
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   709
    "
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   710
  ^ (self new) menu:aSubMenu.
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   711
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   712
    "Modified: / 8.8.1998 / 02:13:11 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   713
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   714
1808
e8628b502a49 methodCategory change
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   715
!MenuPanel methodsFor:'accepting'!
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   716
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   717
accept
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   718
    "accept current selected item
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   719
    "
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   720
    ^ self acceptItem:(self selection) inMenu:self
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   721
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   722
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
   723
accept:anItem 
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   724
    "this is the topMenu: accept item
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   725
    "
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   726
    |value item tgState itemIdx recv panel masterGroup winGrp|
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
   727
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   728
    self superMenu notNil ifTrue:[
1382
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   729
        ^ self topMenu accept:anItem
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   730
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   731
    self selection:nil.
420
ca
parents: 417
diff changeset
   732
ca
parents: 417
diff changeset
   733
    (anItem notNil and:[anItem canAccept]) ifTrue:[
1382
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   734
        tgState := anItem toggleIndication.
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   735
        panel   := anItem menuPanel.
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   736
        itemIdx := panel findFirst:[:el| el == anItem ].
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   737
        item    := anItem.
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   738
        recv    := panel receiver.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   739
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   740
    self doUngrab:true.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   741
510
8f77b9382066 bug fix with redraw
ca
parents: 505
diff changeset
   742
    self isPopUpView ifFalse:[
1382
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   743
        self do:[:el| el updateIndicators].
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   744
        self windowGroup processExposeEvents.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   745
    ] ifTrue:[
1382
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   746
        self unmap.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   747
        (winGrp := self windowGroup) notNil ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   748
            "/ give expose event a chance to arrive
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   749
            [shown and:[realized]] whileTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   750
                winGrp processExposeEventsFor:self
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   751
            ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   752
            masterGroup := winGrp previousGroup.
1382
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   753
        ].
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   754
        self destroy.
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   755
        masterGroup notNil ifTrue:[masterGroup processExposeEvents].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   756
    ].
1710
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   757
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   758
    (item notNil 
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   759
    and:[item showBusyCursorWhilePerforming
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   760
    and:[(winGrp := (masterGroup ? (self windowGroup))) notNil]])
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   761
    ifTrue:[
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   762
        winGrp withWaitCursorDo:[
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   763
            value := self accept:item index:itemIdx toggle:tgState receiver:recv.
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   764
        ]
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   765
    ] ifFalse:[
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   766
        value := self accept:item index:itemIdx toggle:tgState receiver:recv.
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   767
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   768
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   769
    self isPopUpView ifTrue:[
1382
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   770
        self menuAdornmentAt:#value put:value.
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   771
        self menuAdornmentAt:#item  put:item.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   772
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   773
    ^ item.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   774
1212
9bd3220c9964 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
   775
    "Modified: / 22.2.1999 / 20:14:48 / cg"
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   776
!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   777
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   778
accept:anItem index:anIndex toggle:aState receiver:aReceiver
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   779
    "accept an item
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   780
    "
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   781
    |value argument numArgs isKindOfValueModel rec args arg2 
1697
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
   782
     app master fallBack|
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   783
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   784
    anItem isNil ifTrue:[
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   785
        self menuAdornmentAt:#hasPerformed put:true.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   786
      ^ nil
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   787
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   788
1219
6a0d677a6fac removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents: 1218
diff changeset
   789
    self menuAdornmentAt:#hasPerformed put:(aReceiver isValueModel).
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   790
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   791
    (value := anItem value) isNil ifTrue:[
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   792
        ^ anIndex
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   793
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   794
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   795
    (argument := anItem argument) isNil ifTrue:[
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   796
        argument := aState ? anItem
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   797
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   798
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   799
    value isSymbol ifFalse:[
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   800
        "/ a valueHolder or block
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
   801
        (value respondsTo:#valueWithArguments:) ifFalse:[
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
   802
             ^ value
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
   803
        ].
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   804
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   805
        numArgs := value perform:#numArgs ifNotUnderstood:0.
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   806
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   807
        numArgs == 0 ifTrue:[
1697
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
   808
            args := nil
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   809
        ] ifFalse:[
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   810
            numArgs == 1 ifTrue:[
1697
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
   811
                args := Array with:argument
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
   812
            ] ifFalse:[
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
   813
                args := Array with:argument with:self
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   814
            ]
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   815
        ].
1697
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
   816
1710
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   817
        value valueWithArguments:args.
1697
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
   818
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   819
        self menuAdornmentAt:#hasPerformed put:true.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   820
      ^ anIndex
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   821
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   822
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   823
    aReceiver isNil ifTrue:[
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   824
        ^ value
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   825
    ].
1270
0ae582fd7294 send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents: 1267
diff changeset
   826
1219
6a0d677a6fac removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents: 1218
diff changeset
   827
    isKindOfValueModel := aReceiver isValueModel.
1270
0ae582fd7294 send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents: 1267
diff changeset
   828
    isKindOfValueModel ifTrue:[
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   829
        aReceiver value:value
465
67a0f3dd503a in case of performing a selector '0' is returned
ca
parents: 464
diff changeset
   830
    ] ifFalse:[
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   831
        rec := aReceiver.
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   832
        arg2 := self.
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   833
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   834
        "/ support for ST80 style applications
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   835
        "/ (expecting the message to go to the application
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   836
        "/  if not understood by the view)
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   837
        "/ These expect the controller to be passed as argument.
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   838
        "/ sigh.
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   839
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   840
        (aReceiver isView
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   841
        and:[(aReceiver respondsTo:value) not
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   842
        and:[(app := aReceiver application) ~~ aReceiver
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   843
        and:[app notNil]]]) ifTrue:[
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   844
            rec := app.
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   845
            arg2 := aReceiver controller "/ the Views controller
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   846
        ].
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   847
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   848
        (numArgs := value numArgs) == 0 ifTrue:[
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   849
            args := nil
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   850
        ] ifFalse:[
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   851
            numArgs == 1 ifTrue:[
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   852
                args := Array with:argument
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   853
            ] ifFalse:[
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   854
                args := Array with:argument with:arg2
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   855
            ]
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   856
        ].
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   857
1697
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
   858
        fallBack := 
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
   859
            [
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
   860
                "/ mhmh - the receiver did not respond to that message;
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
   861
                "/ if there is a master-application, try that one
1719
ba7ebb56e6fd recursively try masterApps when performing
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
   862
                "/ (recursive)
1697
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
   863
                master := rec perform:#masterApplication ifNotUnderstood:nil.
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
   864
                master notNil ifTrue:[
1719
ba7ebb56e6fd recursively try masterApps when performing
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
   865
                    rec := master.
ba7ebb56e6fd recursively try masterApps when performing
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
   866
                    rec perform:value withArguments:args ifNotUnderstood:fallBack
1697
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
   867
                ] ifFalse:[
1715
c987686f5d37 unimpl. menu message error mayProceed
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   868
                    self 
c987686f5d37 unimpl. menu message error mayProceed
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   869
                        error:'unimplemented menu message: ' , value
c987686f5d37 unimpl. menu message error mayProceed
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   870
                        mayProceed:true
1697
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
   871
                ].
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   872
            ].
1697
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
   873
1710
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   874
        rec perform:value withArguments:args ifNotUnderstood:fallBack.
420
ca
parents: 417
diff changeset
   875
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   876
    self menuAdornmentAt:#hasPerformed put:true.
1270
0ae582fd7294 send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents: 1267
diff changeset
   877
    ^ value
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   878
1719
ba7ebb56e6fd recursively try masterApps when performing
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
   879
    "Modified: / 19.2.2000 / 11:08:22 / cg"
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   880
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   881
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   882
acceptItem:anItem inMenu:aMenu
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   883
    |tgState|
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   884
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
   885
    (anItem isNil or:[anItem hideMenuOnActivated]) ifTrue:[
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   886
        self topMenu accept:anItem
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   887
    ] ifFalse:[
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   888
        anItem canAccept ifTrue:[
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   889
            tgState := anItem toggleIndication.
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   890
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   891
            self accept:anItem
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   892
                  index:(aMenu selectionIndex)
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   893
                 toggle:tgState 
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   894
               receiver:(aMenu receiver).
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   895
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   896
            aMenu do:[:el| el updateIndicators].
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   897
        ]
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   898
    ]
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   899
!
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   900
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   901
lastItemAccepted
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   902
    "returns last item selected or nil
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   903
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   904
  ^ self topMenu menuAdornmentAt:#item
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   905
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   906
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   907
lastValueAccepted
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   908
    "returns last value accepted or nil
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   909
    "
971
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   910
    ^ (self lastItemAccepted) value
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   911
"/    |top|
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   912
"/
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   913
"/    top := self topMenu.
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   914
"/
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   915
"/    (top menuAdornmentAt:#hasPerformed) == true ifTrue:[
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   916
"/        ^ self topMenu menuAdornmentAt:#value.
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   917
"/    ].
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   918
"/  ^ nil
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   919
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   920
    "Modified: / 18.6.1998 / 23:37:09 / cg"
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   921
! !
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   922
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   923
!MenuPanel methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   924
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   925
accessCharacterPositionAt:stringOrNumber
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   926
    "get the access character position for a textLabel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   927
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   928
  ^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   929
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   930
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   931
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   932
    "get the access character position for a textLabel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   933
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   934
    self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   935
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   936
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   937
accessCharacterPositions
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   938
    "returns a collection of accessCharacterPosition's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   939
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   940
    ^ self collect:[:anItem| anItem accessCharacterPosition ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   941
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   942
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   943
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   944
accessCharacterPositions:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   945
    "define accessCharacterPosition's for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   946
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   947
    self onEachPerform:#accessCharacterPosition: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   948
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   949
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   950
args
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   951
    "returns a collection of argument's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   952
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   953
    ^ self collect:[:anItem| anItem argument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   954
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   955
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   956
args:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   957
    "define arguments for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   958
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   959
    self onEachPerform:#argument: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   960
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   961
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   962
argsAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   963
    "gets the argument of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   964
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   965
  ^ self itemAt:stringOrNumber do:[:el| el argument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   966
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   967
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   968
argsAt:stringOrNumber put:anArgument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   969
    "sets the argument of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   970
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   971
    self itemAt:stringOrNumber do:[:el| el argument:anArgument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   972
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   973
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   974
enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   975
    "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
   976
     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
   977
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   978
    ^ enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   979
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   980
    "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
   981
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   982
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   983
groupSizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   984
    "gets collection of group sizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   985
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   986
  ^ groupSizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   987
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   988
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   989
groupSizes:aGroupSizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   990
    "sets collection of group sizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   991
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   992
    aGroupSizes = groupSizes ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   993
	groupSizes := aGroupSizes copy.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   994
	self mustRearrange.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   995
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   996
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   997
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   998
labelAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   999
    "gets the label of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1000
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1001
  ^ self itemAt:stringOrNumber do:[:el| el label ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1002
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1003
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1004
labelAt:stringOrNumber put:aLabel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1005
    "sets the label of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1006
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1007
    self itemAt:stringOrNumber do:[:el| el label:aLabel ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1008
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1009
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1010
labels
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1011
    "returns a collection of labels's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1012
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1013
    ^ self collect:[:anItem| anItem label ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1014
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1015
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1016
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1017
labels:labels
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1018
    "define labels for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1019
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1020
    self disabledRedrawDo:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1021
	self removeAll.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1022
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1023
	labels notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1024
	    labels do:[:aLabel|(self createAtIndex:nil) label:aLabel]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1025
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1026
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1027
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1028
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1029
nameKeyAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1030
    "gets the nameKey of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1031
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1032
  ^ self itemAt:stringOrNumber do:[:el| el nameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1033
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1034
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1035
nameKeyAt:stringOrNumber put:aNameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1036
    "sets the nameKey of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1037
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1038
    self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1039
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1040
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1041
nameKeys
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1042
    "returns a collection of nameKeys's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1043
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1044
    ^ self collect:[:anItem| anItem nameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1045
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1046
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1047
nameKeys:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1048
    "define nameKeys for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1049
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1050
    self onEachPerform:#nameKey: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1051
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1052
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1053
numberOfItems
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1054
    "gets number of items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1055
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1056
    ^ items size
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1057
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1058
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1059
receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1060
    "get the menu-receiver. Thats the one who gets the messages ( both from myself and
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1061
     from all submenus no specific receiver is defined ).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1062
    "
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1063
    (receiver isNil and:[superMenu notNil]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1064
	^ superMenu receiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1065
    ].
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1066
  ^ receiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1067
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1068
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1069
receiver:anObject 
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1070
    "set the menu-receiver. Thats the one who gets the messages ( both from myself and
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1071
     from all submenus no specific receiver is defined ).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1072
    "
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1073
    receiver := anObject
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1074
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1075
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1076
shortcutKeyAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1077
    "gets the shortCutKey of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1078
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1079
  ^ self itemAt:stringOrNumber do:[:el| el shortcutKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1080
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1081
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1082
shortcutKeyAt:stringOrNumber put:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1083
    "sets the shortCutKey of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1084
    "
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1085
    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
  1086
!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1087
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1088
shortcutKeys
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1089
    "returns a collection of shortcutKey's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1090
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1091
    ^ self collect:[:anItem| anItem shortcutKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1092
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1093
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1094
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1095
shortcutKeys:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1096
    "define shortcutKey's for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1097
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1098
    self onEachPerform:#shortcutKey: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1099
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1100
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1101
valueAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1102
    "gets value of an item; a block, valueHolder, ...
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1103
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1104
  ^ self itemAt:stringOrNumber do:[:el| el value ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1105
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1106
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1107
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1108
valueAt:stringOrNumber put:someThing
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1109
    "sets value of an item; a block, valueHolder, ...
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1110
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1111
    self itemAt:stringOrNumber do:[:el| el value:someThing ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1112
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1113
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1114
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1115
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1116
values:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1117
    "define values for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1118
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1119
    self onEachPerform:#value: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1120
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1121
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1122
!MenuPanel methodsFor:'accessing-behavior'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1123
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1124
disableAll
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1125
    "disable all items; not the menu in case of enabled
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1126
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1127
    self do:[:anItem| anItem enabled:false]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1128
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1129
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1130
disableAll:collectionOfIndicesOrNames
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1131
    "disable an collection of items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1132
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1133
    collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1134
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1135
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1136
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1137
enableAll
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1138
    "enable all items; not the menu in case of disabled
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1139
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1140
    self do:[:anItem| anItem enabled:true]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1141
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1142
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1143
enableAll:collectionOfIndicesOrNames
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1144
    "enable an collection of items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1145
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1146
    collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1147
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1148
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1149
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1150
enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1151
    "returns enabled state
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1152
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1153
    ^ enabled
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1154
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1155
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1156
enabled:aState
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1157
    "change enabled state of menu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1158
    "
545
d01d14358b07 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 524
diff changeset
  1159
    |state|
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1160
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1161
    state := aState ? true.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1162
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  1163
    enabled ~~ state ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  1164
        enabled := state.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  1165
        self invalidate.
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1166
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1167
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1168
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1169
enabledAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1170
    "gets the enabled state of an item or false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1171
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1172
  ^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1173
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1174
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1175
enabledAt:stringOrNumber put:aState
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1176
    "sets the enabled state of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1177
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1178
    self itemAt:stringOrNumber do:[:el| el enabled:aState ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1179
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1180
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1181
isEnabled:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1182
    "gets the enabled state of an item or false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1183
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1184
    ^ self enabledAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1185
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1186
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1187
!MenuPanel methodsFor:'accessing-channels'!
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1188
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1189
enableChannel
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1190
    "gets a enable channel or nil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1191
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1192
    ^ enableChannel
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1193
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1194
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1195
enableChannel:aValueHolder
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1196
    "set my enableChannel
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1197
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1198
    enableChannel notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1199
	enableChannel removeDependent:self
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
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1202
    (enableChannel := aValueHolder) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1203
	enableChannel addDependent:self.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1204
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1205
    self enabled:(enableChannel value).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1206
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1207
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1208
menuHolder
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1209
    "gets a menu holder or nil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1210
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1211
    ^ menuHolder
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1212
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1213
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1214
menuHolder:aValueHolder
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1215
    "set my menuHolder
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1216
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1217
    menuHolder notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1218
	menuHolder removeDependent:self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1219
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1220
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1221
    (menuHolder := aValueHolder) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1222
	menuHolder addDependent:self.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1223
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1224
    self menu:(menuHolder value)
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1225
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
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-color & font'!
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1228
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1229
activeBackgroundColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1230
    "get the background drawing color used to highlight selection
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1231
    "
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1232
    ^ activeBgColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1233
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1234
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1235
activeForegroundColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1236
    "get the foreground color used to highlight selections
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1237
    "
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1238
    ^ activeFgColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1239
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1240
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1241
backgroundColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1242
    "return the background color
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1243
    "
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  1244
    ^ super viewBackground
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1245
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1246
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1247
backgroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1248
    "set the background drawing color. You should not use this method;
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1249
     instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1250
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1251
    super viewBackground ~~ aColor ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1252
	super viewBackground:aColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1253
	shown ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1254
	    self invalidate "/ RepairNow:true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1255
	]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1256
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1257
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1258
    "Modified: / 6.6.1998 / 19:50:06 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1259
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1260
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1261
buttonActiveBackgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1262
    "get the background drawing color used to highlight button selection
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1263
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1264
    ^ButtonActiveBackgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1265
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1266
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1267
buttonEdgeStyle
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1268
    "get the button edge style
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1269
    "
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1270
    ^ButtonEdgeStyle
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1271
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1272
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1273
buttonEnteredBackgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1274
    "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
  1275
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1276
    ^ buttonEnteredBgColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1277
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1278
    "Created: / 20.8.1998 / 13:53:37 / cg"
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1279
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1280
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1281
buttonEnteredLevel
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1282
    "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
  1283
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1284
    ^ ButtonEnteredLevel
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1285
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1286
    "Created: / 20.8.1998 / 13:53:46 / cg"
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1287
    "Modified: / 20.8.1998 / 15:49:32 / cg"
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1288
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1289
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1290
buttonHalfLightColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1291
    "get the background drawing color used to half light button frame
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1292
    "
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1293
    ^buttonHalfLightColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1294
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1295
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1296
buttonHalfShadowColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1297
    "get the background drawing color used to half shadow button frame
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1298
    "
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1299
    ^buttonHalfShadowColor
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1300
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1301
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1302
buttonLightColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1303
    "get the background drawing color used to light button frame
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1304
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1305
    ^buttonLightColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1306
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1307
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1308
buttonPassiveBackgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1309
    "get the background drawing color used for button
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1310
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1311
    ^ButtonPassiveBackgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1312
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1313
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1314
buttonShadowColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1315
    "get the background drawing color used to shadow button frame
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1316
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1317
    ^buttonShadowColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1318
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1319
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1320
disabledForegroundColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1321
    "return the foreground color used by disabled items
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1322
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1323
  ^ disabledFgColor
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1324
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1325
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1326
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1327
font:aFont
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1328
    "set the font
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1329
    "
829
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  1330
    (aFont notNil and:[aFont ~= font]) ifTrue:[
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1331
        super font:(aFont onDevice:device).
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1332
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1333
        superMenu notNil ifTrue:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1334
            self extent:(self preferredExtent)
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1335
        ].
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1336
        self mustRearrange.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1337
    ]
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1338
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1339
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1340
foregroundColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1341
    "return the passive foreground color
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1342
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1343
  ^ fgColor
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1344
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1345
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1346
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1347
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1348
foregroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1349
    "set the foregroundColor drawing color. You should not use this method;
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1350
     instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1351
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1352
    fgColor ~~ aColor ifTrue:[
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1353
        fgColor := aColor onDevice:device.
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1354
        shown ifTrue:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1355
            self invalidate "/ RepairNow:true
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1356
        ]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1357
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1358
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1359
    "Modified: / 6.6.1998 / 19:50:46 / cg"
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  1360
!
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  1361
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1362
lightColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1363
    "get the lightColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1364
    "
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1365
    ^ lightColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1366
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1367
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1368
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1369
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1370
maxAbsoluteButtonLevel
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1371
    "returns the maximum absolute button level; used to compute the preferred
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1372
     extent of a button
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1373
    "
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1374
    |level|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1375
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1376
    level := (ButtonActiveLevel abs) max:(ButtonEnteredLevel abs).
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1377
  ^ level max:(ButtonPassiveLevel abs)
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1378
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1379
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1380
selectionFrameBrightColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1381
    "get the selection frame bright color
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1382
    "
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1383
    ^selectionFrameBrightColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1384
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1385
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1386
selectionFrameDarkColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1387
    "get the selection frame dark color
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1388
    "
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1389
    ^selectionFrameDarkColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1390
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1391
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1392
setFont:aFont
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1393
    "set the font derived from item; if unchanged nil is returned otherwise the old font
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1394
    "
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1395
    |currentFont|
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1396
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1397
    (aFont notNil and:[aFont ~= font]) ifTrue:[
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1398
        currentFont := font.
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1399
        super font:aFont.
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1400
    ].
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1401
    ^ currentFont
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1402
!
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1403
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1404
shadowColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1405
    "get the shadowColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1406
    "
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1407
    ^ shadowColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1408
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1409
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1410
! !
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1411
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1412
!MenuPanel methodsFor:'accessing-dimensions'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1413
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1414
height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1415
    "default height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1416
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1417
    (explicitExtent ~~ true) ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1418
        ^ self preferredExtent y
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1419
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1420
    ^ super height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1421
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1422
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1423
preferredExtent
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1424
    "compute and returns my preferred extent
1723
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  1425
        !!!!!! changes have influence on method #rearrangeItems !!!!!!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1426
    "
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1427
    |hasMenu shCtKey extent showAcc sck
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1428
     x           "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1429
     y           "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1430
     size        "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1431
     buttonInset "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1432
     labelInset  "{ Class:SmallInteger }"
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  1433
    |
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1434
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1435
    (size := items size) == 0 ifTrue:[
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1436
        ^ 32 @ 32
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1437
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1438
    buttonInset := 2 * (DefaultButtonItemSpace abs).
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1439
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1440
    self isPopUpView ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1441
        labelInset := 2 * (DefaultEnteredLevel abs).
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1442
    ] ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1443
        labelInset := 0.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1444
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1445
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1446
    x := 0.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1447
    y := 0.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1448
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1449
    self verticalLayout ifFalse:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1450
        "/ HORIZONTAL LAYOUT
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1451
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1452
        items keysAndValuesDo:[:key :el| |eX eY|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1453
            extent := el preferredExtent.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1454
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1455
            "/ check for visibility (extent x ~~ 0)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1456
            (eX := extent x) ~~ 0 ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1457
                eY := extent y.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1458
                
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1459
                el isButton ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1460
                    eX := eX + buttonInset.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1461
                    eY := eY + buttonInset.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1462
                ] ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1463
                    eX := eX + labelInset.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1464
                    eY := eY + labelInset.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1465
                ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1466
                key ~~ size ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1467
                    (self hasGroupDividerAt:key) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1468
                        x := x + groupDividerSize
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1469
                    ] ifFalse:[
1723
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  1470
                        el isLabeledItem ifTrue:[
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  1471
                            x := x + itemSpace
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  1472
                        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1473
                    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1474
                ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1475
                x := eX + x.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1476
                y := eY max:y.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1477
            ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1478
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1479
    ] ifTrue:[
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1480
        hasMenu := false.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1481
        shCtKey := 0.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1482
        showAcc := MenuView showAcceleratorKeys == true.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1483
        y := x.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1484
        x := 0.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1485
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1486
        items keysAndValuesDo:[:key :el| |eX eY|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1487
            extent := el preferredExtent.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1488
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1489
            "/ check for visibility (extent x ~~ 0)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1490
            (eX := extent x) ~~ 0 ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1491
                eY := extent y.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1492
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1493
                el isButton ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1494
                    eX := eX + buttonInset.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1495
                    eY := eY + buttonInset.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1496
                ] ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1497
                    eX := eX + labelInset.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1498
                    eY := eY + labelInset.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1499
                ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1500
                hasMenu ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1501
                    hasMenu := el hasSubmenu
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1502
                ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1503
                (showAcc and:[(sck := el shortcutKeyAsString) notNil]) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1504
                    shCtKey := shCtKey max:(sck widthOn:self)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1505
                ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1506
                key ~~ size ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1507
                    (self hasGroupDividerAt:key) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1508
                        y := y + groupDividerSize
1723
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  1509
"/                    ] ifFalse:[
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  1510
"/                        y := y + itemSpace
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1511
                    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1512
                ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1513
                y := eY + y.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1514
                x := eX max:x.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1515
            ].
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1516
        ].
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1517
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1518
        (hasMenu or:[shCtKey ~~ 0]) ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1519
            shortKeyInset := x + Item labelRightOffset.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1520
            x := shortKeyInset + shCtKey + self subMenuIndicationWidth.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1521
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1522
            (shCtKey ~~ 0 and:[hasMenu]) ifTrue:[
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1523
                x := x + ShortcutKeyOffset 
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1524
            ]
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1525
        ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1526
"/ to have a small inset
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1527
        y := y + 1.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1528
"/        x := x + 1.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1529
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1530
    x := x + margin + margin.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1531
    y := y + margin + margin.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1532
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1533
  ^ x @ y
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1534
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1535
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1536
shortKeyInset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1537
    "left inset of shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1538
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1539
  ^ shortKeyInset
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1540
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1541
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1542
subMenuIndicationWidth
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1543
    ^ RightArrowForm width
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1544
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1545
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1546
!MenuPanel methodsFor:'accessing-interactors'!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1547
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1548
iconIndicationDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1549
    iconIndicationDisabledOff isNil ifTrue:[
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1550
        superMenu notNil ifTrue:[
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1551
            iconIndicationDisabledOff := superMenu iconIndicationDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1552
        ] ifFalse:[
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1553
            iconIndicationDisabledOff := self registerImageOnDevice:(self class iconIndicationDisabledOff)
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1554
        ].
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1555
    ].
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1556
    ^ iconIndicationDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1557
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1558
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1559
iconIndicationDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1560
    iconIndicationDisabledOn isNil ifTrue:[
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1561
        superMenu notNil ifTrue:[
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1562
            iconIndicationDisabledOn := superMenu iconIndicationDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1563
        ] ifFalse:[
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1564
            iconIndicationDisabledOn := self registerImageOnDevice:(self class iconIndicationDisabledOn)
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1565
        ].
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1566
    ].
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1567
    ^ iconIndicationDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1568
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1569
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1570
iconIndicationOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1571
    iconIndicationOff isNil ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1572
        superMenu notNil ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1573
            iconIndicationOff := superMenu iconIndicationOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1574
        ] ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1575
            iconIndicationOff := self registerImageOnDevice:(self class iconIndicationOff)
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1576
        ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1577
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1578
    ^ iconIndicationOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1579
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1580
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1581
iconIndicationOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1582
    iconIndicationOn isNil ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1583
        superMenu notNil ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1584
            iconIndicationOn := superMenu iconIndicationOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1585
        ] ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1586
            iconIndicationOn := self registerImageOnDevice:(self class iconIndicationOn)
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1587
        ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1588
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1589
    ^ iconIndicationOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1590
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1591
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1592
iconRadioGroupDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1593
    iconRadioGroupDisabledOff isNil ifTrue:[
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1594
        superMenu notNil ifTrue:[
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1595
            iconRadioGroupDisabledOff := superMenu iconRadioGroupDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1596
        ] ifFalse:[
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1597
            iconRadioGroupDisabledOff := self registerImageOnDevice:(self class iconRadioGroupDisabledOff)
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1598
        ].
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1599
    ].
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1600
    ^ iconRadioGroupDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1601
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1602
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1603
iconRadioGroupDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1604
    iconRadioGroupDisabledOn isNil ifTrue:[
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1605
        superMenu notNil ifTrue:[
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1606
            iconRadioGroupDisabledOn := superMenu iconRadioGroupDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1607
        ] ifFalse:[
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1608
            iconRadioGroupDisabledOn := self registerImageOnDevice:(self class iconRadioGroupDisabledOn)
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1609
        ].
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1610
    ].
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1611
    ^ iconRadioGroupDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1612
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1613
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1614
iconRadioGroupOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1615
    iconRadioGroupOff isNil ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1616
        superMenu notNil ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1617
            iconRadioGroupOff := superMenu iconRadioGroupOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1618
        ] ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1619
            iconRadioGroupOff := self registerImageOnDevice:(self class iconRadioGroupOff)
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1620
        ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1621
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1622
    ^ iconRadioGroupOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1623
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1624
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1625
iconRadioGroupOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1626
    iconRadioGroupOn isNil ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1627
        superMenu notNil ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1628
            iconRadioGroupOn := superMenu iconRadioGroupOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1629
        ] ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1630
            iconRadioGroupOn := self registerImageOnDevice:(self class iconRadioGroupOn)
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1631
        ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1632
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1633
    ^ iconRadioGroupOn
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
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1636
!MenuPanel methodsFor:'accessing-items'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1637
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1638
itemAt:stringOrNumber
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1639
    "returns item assigned to an index, nameKey, textLabel or value if symbol.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1640
     If no item match nil is returned.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1641
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1642
    |idx|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1643
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1644
    idx := self indexOf:stringOrNumber.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1645
    (idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1646
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1647
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1648
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1649
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1650
itemAt:stringOrNumber do:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1651
    "evaluate teh block for an item and return the result from the block. In case that  
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1652
     the item not exists nil is returned
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1653
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1654
    ^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1655
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1656
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1657
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1658
    "evaluate teh block for an item and return the result from the block. In case that  
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1659
     the item not exists the result of the exception block is returned (no arguments).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1660
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1661
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1662
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1663
    item := self itemAt:stringOrNumber.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1664
    item notNil ifTrue:[ ^ aOneArgBlock value:item ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1665
  ^ exceptionBlock value
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1666
!
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1667
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1668
itemAtIndex:anIndex
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1669
    "returns item at an index or nil
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1670
    "
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1671
    ^ 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
  1672
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1673
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1674
items
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1675
    "returns list of items or nil
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1676
    "
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1677
    ^ items
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1678
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1679
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1680
!MenuPanel methodsFor:'accessing-look'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1681
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1682
buttonActiveLevel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1683
    "get the button active level
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1684
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1685
    ^ButtonActiveLevel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1686
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1687
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1688
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1689
buttonPassiveLevel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1690
    "get the button passive level
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1691
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1692
    ^ButtonPassiveLevel
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
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1696
fitFirstPanel
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1697
    "gets true if the first panel in the menu hierarchy must be fit 
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1698
     to the extent of its superView
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1700
     NOT SUPPORTED
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1701
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1702
    ^ fitFirstPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1703
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1704
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1705
fitFirstPanel:aState
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1706
    "sets true if the first panel in the menu hierarchy must be fit 
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1707
     to the extent of its superView
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1708
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1709
     NOT SUPPORTED
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1710
    "
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1711
    fitFirstPanel := aState.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1712
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1713
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1714
groupDividerSize
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1715
    "get the size of the group dividers
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1716
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1717
  ^ groupDividerSize
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1718
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1719
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1720
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1721
groupDividerSize:aSize
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1722
    "set the size of the group dividers. You should not use this
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1723
     method; instead leave the value as defined in the styleSheet.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1724
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1725
    aSize ~~ groupDividerSize ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1726
	groupDividerSize := aSize.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1727
	self mustRearrange.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1728
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1729
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1730
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1731
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1732
itemSpace
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1733
    "get the space space between to items
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1734
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1735
  ^ itemSpace
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1736
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1737
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1738
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1739
itemSpace:aSize
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1740
    "set the horizontal space between to items. You should not use this
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1741
     method; instead leave the value as defined in the styleSheet.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1742
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1743
    aSize ~~ itemSpace ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1744
	itemSpace := aSize.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1745
	self mustRearrange
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1746
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1747
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1748
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1749
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1750
level:anInt
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1751
    super level:anInt.
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1752
    mustRearrange := true
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1753
!
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1754
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1755
rightArrow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1756
    ^ rightArrow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1757
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1758
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1759
rightArrowShadow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1760
    ^ rightArrowShadow
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1761
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1762
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1763
showGroupDivider
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1764
    "get the enabled flag for showing groupDiveders
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1765
    "
1222
8d58a1a93582 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1221
diff changeset
  1766
  ^ (self menuAdornmentAt:#showGroupDivider)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1767
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1768
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1769
showGroupDivider:aState
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1770
    "set the enabled flag for showing groupDiveders
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1771
    "
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1772
    (self menuAdornmentAt:#showGroupDivider put:aState) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1773
	self mustRearrange.
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1774
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1775
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1776
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1777
showSeparatingLines
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1778
    "gets true if drawing of separating lines is enabled.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1779
    "
1222
8d58a1a93582 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1221
diff changeset
  1780
  ^ (self menuAdornmentAt:#showSeparatingLines)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1781
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1782
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1783
showSeparatingLines:aState
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1784
    "turn on/off drawing of separating lines.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1785
    "
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1786
    (self menuAdornmentAt:#showSeparatingLines put:aState) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1787
	self mustRearrange
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1788
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1789
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1790
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1791
verticalLayout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1792
    "get the layout: or vertical( true ) or horizontal( false )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1793
    "
1824
ad38ecd8752d support horizontal or vertical layout for popup menus
ca
parents: 1819
diff changeset
  1794
    |direction|
ad38ecd8752d support horizontal or vertical layout for popup menus
ca
parents: 1819
diff changeset
  1795
ad38ecd8752d support horizontal or vertical layout for popup menus
ca
parents: 1819
diff changeset
  1796
    direction := self menuAdornmentAt:#verticalLayout.
ad38ecd8752d support horizontal or vertical layout for popup menus
ca
parents: 1819
diff changeset
  1797
  ^ direction notNil ifTrue:[direction] ifFalse:[superMenu notNil]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1798
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1799
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1800
verticalLayout:aState
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1801
    "set the layout: or vertical( true ) or horizontal( false )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1802
    "
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1803
    (self menuAdornmentAt:#verticalLayout put:aState) ifTrue:[        
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1804
	self mustRearrange
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1805
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1806
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1807
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1808
!MenuPanel methodsFor:'accessing-submenu'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1809
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1810
subMenuAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1811
    "gets the submenu of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1812
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1813
  ^ self itemAt:stringOrNumber do:[:el| el submenu ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1814
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1815
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1816
subMenuAt:stringOrNumber put:aSubMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1817
    "sets the submenu of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1818
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1819
    self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1820
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1821
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1822
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1823
subMenuShown
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1824
    "return the currently visible submenu - or nil if there is none
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1825
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1826
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1827
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1828
    (item := self selection) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1829
	^ item submenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1830
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1831
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1832
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1833
1698
8d29156bab20 category rename
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  1834
!MenuPanel methodsFor:'activation / deactivation'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1835
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  1836
closeMenus
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  1837
    "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
  1838
    "
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  1839
    self topMenu accept:nil.
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  1840
!
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  1841
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1842
hide
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1843
    "hide the view, leave its modal event loop
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1844
    "
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1845
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1846
    self selection:nil.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1847
    self unmap.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1848
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1849
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1850
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1851
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1852
show
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1853
    "realize the view at its last position;
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1854
     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
  1855
     (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
  1856
      to some performer)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1857
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1858
  ^ self showAt:(self origin) resizing:true
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1859
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1860
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1861
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1862
showAt:aPoint
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1863
    "realize the view at aPoint.
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1864
     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
  1865
     (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
  1866
      to some performer)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1867
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1868
  ^ self showAt:aPoint resizing:true
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1869
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1870
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1871
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1872
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1873
showAt:aPoint resizing:aBoolean
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1874
    "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
  1875
     or if I have already performed.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1876
     Return the items value, otherwise.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1877
     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
  1878
     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
  1879
     if a non-nil is returned.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1880
    "
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1881
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  1882
    self rearrangeItemsIfItemVisibilityChanged.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1883
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1884
    aBoolean ifTrue:[
1459
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  1885
        self fixSize.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1886
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1887
    self origin:aPoint.
1459
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  1888
"/    self makeFullyVisible.   -- done in realize
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1889
    self openModal:[true]. "realize     "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1890
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1891
    "/ if I have already performed,
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1892
    "/ return nil - to avoid items triggering twice.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1893
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1894
    (self topMenu menuAdornmentAt:#hasPerformed) == true ifTrue:[
1459
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  1895
        ^ nil
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1896
    ].
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1897
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1898
    ^ self lastValueAccepted
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1899
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1900
    "Modified: / 15.9.1998 / 12:50:23 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1901
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1902
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1903
showAtPointer
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1904
    "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
  1905
     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
  1906
     (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
  1907
      to some performer)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1908
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1909
  ^ self showAt:(device pointerPosition) resizing:true
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1910
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1911
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1912
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1913
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1914
showCenteredIn:aView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1915
    "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
  1916
     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
  1917
     (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
  1918
      to some performer)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1919
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1920
    |top|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1921
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1922
    top := aView topView.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1923
    top raise.
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1924
    ^ 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
  1925
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1926
    "Modified: / 15.9.1998 / 12:45:50 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1927
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1928
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1929
startUp
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1930
    "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
  1931
     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
  1932
     (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
  1933
      to some performer)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1934
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1935
    ^ self showAtPointer
897
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1936
!
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1937
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1938
startUpAt:aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1939
    "realize the menu at aPoint
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1940
     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
  1941
     (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
  1942
      to some performer)
897
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1943
    "
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1944
    ^ self showAt:aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1945
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1946
    "Created: / 21.5.1998 / 14:15:57 / cg"
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  1947
!
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  1948
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  1949
startUpOrNil
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  1950
    "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
  1951
     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
  1952
     (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
  1953
      to some performer)
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  1954
    "
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  1955
    ^ self showAtPointer
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1956
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1957
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1958
!MenuPanel methodsFor:'adding & removing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1959
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1960
createAtIndex:anIndexOrNil
1800
600f247a2846 comment
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  1961
    "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
  1962
     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
  1963
     otherwise the new created item is returned.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1964
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1965
    |max item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1966
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1967
    max := (items size) + 1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1968
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1969
    anIndexOrNil notNil ifTrue:[
1800
600f247a2846 comment
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  1970
        (anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[
600f247a2846 comment
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  1971
            ^ nil
600f247a2846 comment
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  1972
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1973
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1974
    items isNil ifTrue:[
1800
600f247a2846 comment
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  1975
        items := OrderedCollection new
1151
199863d6a463 items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents: 1137
diff changeset
  1976
    ] ifFalse:[
1800
600f247a2846 comment
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  1977
        items := items asOrderedCollection
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1978
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1979
    item := Item in:self.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1980
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1981
    (anIndexOrNil isNil or:[anIndexOrNil == max]) ifTrue:[
1800
600f247a2846 comment
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  1982
        items add:item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1983
    ] ifFalse:[
1800
600f247a2846 comment
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  1984
        items add:item beforeIndex:anIndexOrNil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1985
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1986
    ^ item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1987
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1988
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1989
remove:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1990
    "remove the first item which is assigned to stringOrNumber;
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1991
     if found, remove and return it
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1992
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1993
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1994
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1995
    (item := self itemAt:stringOrNumber) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1996
	items remove:item.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1997
	item  destroy.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1998
	items isEmpty ifTrue:[items := nil].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1999
	self mustRearrange.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2000
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2001
  ^ item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2002
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2003
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2004
removeAll
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2005
    "remove all items and submenus
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2006
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2007
    self disabledRedrawDo:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2008
	self selection:nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2009
	groupSizes := nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2010
	self do:[:el| el destroy ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2011
	items := nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2012
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2013
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2014
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2015
!MenuPanel methodsFor:'change & update'!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2016
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2017
update:something with:aParameter from:changedObject
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2018
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2019
    changedObject == menuHolder    ifTrue:[^ self menu:(menuHolder value)].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2020
    changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2021
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2022
    super update:something with:aParameter from:changedObject
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2023
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2024
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2025
!MenuPanel methodsFor:'converting'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2026
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2027
asMenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2028
    "convert contents to menu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2029
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2030
    |menu|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2031
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2032
    menu := Menu new.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2033
    menu groupSizes:groupSizes.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2034
    self do:[:anItem| menu addItem:(anItem asMenuItem) ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2035
  ^ menu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2036
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2037
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2038
fromSpec:aMenuSpec
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2039
    "build from spec
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2040
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2041
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2042
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2043
    menu := Menu new.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2044
    menu fromLiteralArrayEncoding:aMenuSpec.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2045
    self menu:menu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2046
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2047
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2048
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2049
menu:aMenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2050
    "convert to Menu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2051
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2052
    self disabledRedrawDo:[
1666
cbeea1429021 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1660
diff changeset
  2053
        |menu newItems|
cbeea1429021 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1660
diff changeset
  2054
cbeea1429021 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1660
diff changeset
  2055
        self removeAll.
cbeea1429021 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1660
diff changeset
  2056
cbeea1429021 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1660
diff changeset
  2057
        (menu := aMenu) notNil ifTrue:[
cbeea1429021 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1660
diff changeset
  2058
            (aMenu isCollection) ifTrue:[
cbeea1429021 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1660
diff changeset
  2059
                menu := Menu new.
cbeea1429021 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1660
diff changeset
  2060
                menu fromLiteralArrayEncoding:aMenu.
cbeea1429021 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1660
diff changeset
  2061
            ] ifFalse:[
cbeea1429021 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1660
diff changeset
  2062
                menu receiver notNil ifTrue:[receiver := menu receiver]
cbeea1429021 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1660
diff changeset
  2063
            ].
cbeea1429021 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1660
diff changeset
  2064
            (newItems := menu menuItems) size > 0 ifTrue:[
cbeea1429021 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1660
diff changeset
  2065
                items := newItems collect:[:ni | 
cbeea1429021 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1660
diff changeset
  2066
                                |i|
cbeea1429021 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1660
diff changeset
  2067
cbeea1429021 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1660
diff changeset
  2068
                                i:= Item in:self.
cbeea1429021 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1660
diff changeset
  2069
                                i menuItem:ni.
cbeea1429021 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1660
diff changeset
  2070
                                i.
cbeea1429021 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1660
diff changeset
  2071
                            ].
cbeea1429021 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1660
diff changeset
  2072
            ].
cbeea1429021 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1660
diff changeset
  2073
            self groupSizes:(menu groupSizes).
cbeea1429021 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1660
diff changeset
  2074
        ]
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2075
    ]
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2076
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2077
    "Modified: / 8.8.1998 / 02:05:04 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2078
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2079
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2080
!MenuPanel methodsFor:'drawing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2081
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2082
disabledRedrawDo:aBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2083
    "evaluate a block without redrawing within the block; after processing
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2084
     of the block a redraw might be performed
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2085
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2086
    |state|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2087
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2088
    state := mustRearrange.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2089
    mustRearrange := true.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2090
    aBlock value.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2091
    mustRearrange := state.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2092
    self mustRearrange
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2093
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2094
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2095
drawButtonEdgesFor:anItem level:aLevel
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2096
    |layout|
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2097
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2098
    aLevel ~~ 0 ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2099
        layout := anItem layout.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2100
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2101
        styleSheet is3D ifFalse:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2102
            self displayRectangle:layout.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2103
        ] ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2104
            self drawEdgesForX:(layout left)
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2105
                             y:(layout top)
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2106
                         width:(layout width)
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2107
                        height:(layout height)
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2108
                         level:aLevel 
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2109
                        shadow:buttonShadowColor 
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2110
                         light:buttonLightColor
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2111
                    halfShadow:buttonHalfShadowColor 
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2112
                     halfLight:buttonHalfLightColor
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2113
                         style:ButtonEdgeStyle
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2114
        ]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2115
    ]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2116
!
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2117
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2118
drawLabelEdgeFor:anItem selected:isSelected
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2119
    |level layout|
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2120
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2121
    isSelected ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2122
        level := onLevel
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2123
    ] ifFalse:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2124
        anItem == enteredItem ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2125
            level := DefaultEnteredLevel
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2126
        ] ifFalse:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2127
            level := offLevel
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2128
        ]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2129
    ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2130
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2131
    level ~~ 0 ifTrue:[
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2132
        layout := anItem layout.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2133
1691
8e1a9d7a298e bugfix in drawLableEdge...
ca
parents: 1690
diff changeset
  2134
        self drawEdgesForX:(layout left)
8e1a9d7a298e bugfix in drawLableEdge...
ca
parents: 1690
diff changeset
  2135
                         y:(layout top)
8e1a9d7a298e bugfix in drawLableEdge...
ca
parents: 1690
diff changeset
  2136
                     width:(layout width)
8e1a9d7a298e bugfix in drawLableEdge...
ca
parents: 1690
diff changeset
  2137
                    height:(layout height)
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2138
                     level:level
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2139
    ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2140
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2141
!
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2142
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2143
invalidateItem:anItem repairNow:aBool
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2144
    "an item changed; invalidate the items layout
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2145
    "
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2146
    (mustRearrange not and:[shown]) ifTrue:[
1728
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2147
        self invalidate:(anItem layout copy insetBy:-1) repairNow:aBool
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2148
    ].
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2149
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2150
    "Modified: / 29.2.2000 / 11:28:59 / cg"
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  2151
!
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  2152
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2153
mustRearrange
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  2154
    "force rearrange (i.e. set the rearrange flag)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2155
    "
590
3177528b5f95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  2156
    mustRearrange == true ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2157
	mustRearrange := true.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2158
	shown ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2159
	    self invalidate "/ RepairNow:true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2160
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2161
    ]
590
3177528b5f95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  2162
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  2163
    "Modified: / 6.6.1998 / 19:51:07 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2164
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2165
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2166
rearrangeGroups
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2167
    "implements the groupIdentifier #right in a horizontal menu
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2168
    "
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2169
    |layout point
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2170
     dltX  "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2171
     start "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2172
    |
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2173
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2174
    (self isPopUpView or:[self verticalLayout]) ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2175
        ^ self
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2176
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2177
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2178
    layout := items last layout.
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2179
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2180
    (dltX := width - margin - layout right) <= 0 ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2181
        ^ self  "/ no free space
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2182
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2183
    start := items findFirst:[:anItem| anItem startGroup == #right ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2184
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2185
    start == 0 ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2186
        ^ self  "/ no item detected
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2187
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2188
    point := dltX @ 0.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2189
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2190
    "/ move items layout to right
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2191
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2192
    items from:start do:[:anItem|
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2193
        anItem isVisible ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2194
            anItem layout moveBy:point.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2195
        ]
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2196
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2197
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2198
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2199
rearrangeItems
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2200
    "recompute the layout of each item
1723
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  2201
        !!!!!! changes have influence on method #preferredExtent !!!!!!
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2202
    "
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2203
    |isVertical extent isPopUpMenu
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2204
     x           "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2205
     y           "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2206
     x0          "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2207
     y0          "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2208
     x1          "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2209
     y1          "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2210
     size        "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2211
     inset       "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2212
     labelInset  "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2213
     buttonInset "{ Class:SmallInteger }"
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2214
    |
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2215
    (mustRearrange and:[(size := items size) ~~ 0]) ifFalse:[
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2216
        mustRearrange := false.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2217
      ^ self
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2218
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2219
    isVertical  := self verticalLayout.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2220
    buttonInset := DefaultButtonItemSpace abs.
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2221
    isPopUpMenu := self isPopUpView.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2222
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2223
    isPopUpMenu ifFalse:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2224
        labelInset := DefaultEnteredLevel abs.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2225
    ] ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2226
        labelInset := 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2227
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2228
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2229
    (isPopUpMenu or:[explicitExtent ~~ true]) ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2230
        extent := self preferredExtent copy.
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2231
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2232
        isPopUpMenu ifFalse:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2233
            isVertical ifTrue:[extent y:1.0] ifFalse:[extent x:1.0]
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2234
        ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2235
        self extent:extent
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2236
    ] ifFalse:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2237
        extent := self computeExtent
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2238
    ].
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2239
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  2240
    x := y := margin.
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  2241
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2242
    isVertical ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2243
        y0 := margin.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2244
        y1 := extent y - margin.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2245
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2246
        items keysAndValuesDo:[:anIndex :el|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2247
            el isVisible ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2248
                el layout:(Rectangle left:x top:y0 right:x bottom:y1)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2249
            ] ifTrue:[
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2250
                el isButton ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2251
                    inset := DefaultButtonItemSpace
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2252
                ] ifFalse:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2253
                    inset := labelInset
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2254
                ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2255
                x0 := x  + inset.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2256
                x1 := x0 + el preferredExtent x.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2257
                el layout:(Rectangle left:x0 top:(y0 + inset) right:x1 bottom:(y1 - inset)).
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2258
                x := x1 + inset.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2259
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2260
                size ~~ anIndex ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2261
                    (self hasGroupDividerAt:anIndex) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2262
                        x := x + groupDividerSize
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2263
                    ] ifFalse:[
1723
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  2264
                        el isLabeledItem ifTrue:[
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  2265
                            x := x + itemSpace
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  2266
                        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2267
                    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2268
                ]
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2269
            ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2270
        ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2271
    ] ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2272
        x0 := margin.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2273
        x1 := extent x - margin.  "/ -1
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2274
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2275
        items keysAndValuesDo:[:anIndex :el|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2276
            el isVisible ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2277
                el layout:(Rectangle left:x0 top:y right:x1 bottom:y)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2278
            ] ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2279
                el isButton ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2280
                    inset := DefaultButtonItemSpace
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2281
                ] ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2282
                    inset := labelInset
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2283
                ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2284
                y0 := y  + inset.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2285
                y1 := y0 + el preferredExtent y.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2286
                el layout:(Rectangle left:(x0 + inset) top:y0 right:(x1 - inset) bottom:y1).
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2287
                y := y1 + inset.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2288
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2289
                size ~~ anIndex ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2290
                    (self hasGroupDividerAt:anIndex) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2291
                        y := y + groupDividerSize
1723
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  2292
"/                    ] ifFalse:[
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  2293
"/                        y := y + itemSpace
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2294
                    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2295
                ]
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2296
            ]
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2297
        ]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2298
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2299
    self rearrangeGroups.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2300
    mustRearrange := false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2301
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2302
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2303
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2304
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2305
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2306
rearrangeItemsIfItemVisibilityChanged
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2307
    "check for items which can change its visibility;
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2308
     if at least one item exists, rearrange all items
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2309
    "
1464
3070de4c8b88 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
  2310
    items isNil ifTrue:[^ self].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2311
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2312
    items do:[:item |
1464
3070de4c8b88 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
  2313
        item canChangeVisibility ifTrue:[
3070de4c8b88 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
  2314
            mustRearrange := true.
3070de4c8b88 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
  2315
            self rearrangeItems.
3070de4c8b88 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
  2316
            ^ self
3070de4c8b88 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
  2317
        ].
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2318
    ]
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2319
!
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2320
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2321
redrawX:x y:y width:w height:h
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2322
    "redraw a rectangle
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2323
    "
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2324
    |isVertical item layout prevClip
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2325
     x1             "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2326
     x2             "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2327
     y1             "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2328
     y2             "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2329
     start          "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2330
     stop           "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2331
     size           "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2332
     groupDivInset  "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2333
    |
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2334
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2335
    (shown and:[w ~~ 0]) ifFalse:[^ self].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2336
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2337
    mustRearrange ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2338
        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
  2339
        self rearrangeItems.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2340
      ^ self invalidate
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2341
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2342
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2343
    self paint:(self backgroundColor).
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2344
    self clearRectangleX:x y:y width:w height:h.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2345
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2346
    (size := items size) == 0 ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2347
        ^ self
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2348
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2349
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2350
    isVertical := self verticalLayout.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2351
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2352
    isVertical ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2353
        start := items findFirst:[:el| el layout bottom > y ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2354
        start == 0 ifTrue:[ ^ self ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2355
        y1 := y + h.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2356
        stop := items findFirst:[:el| el layout top > y1 ] startingAt:(start + 1).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2357
    ] ifFalse:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2358
        start := items findFirst:[:el| el layout right > x ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2359
        start == 0 ifTrue:[ ^ self ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2360
        x1  := x + w.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2361
        stop := items findFirst:[:el| el layout left > x1] startingAt:(start + 1).
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2362
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2363
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2364
    stop == 0 ifTrue:[stop := size] ifFalse:[stop := stop - 1].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2365
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2366
    (groupSizes size ~~ 0 and:[self showGroupDivider]) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2367
        groupDivInset := groupDividerSize // 2.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2368
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2369
        groupDivInset ~~ 0 ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2370
            (start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2371
                start := start - 1
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2372
            ]
1387
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2373
        ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2374
    ] ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2375
        groupDivInset := 0
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2376
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2377
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2378
    prevClip := clipRect.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2379
    self clippingRectangle:(Rectangle left:x top:y width:w height:h).
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2380
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2381
    start to:stop do:[:i|
1387
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2382
        item := items at:i.
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2383
        item redraw.
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2384
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2385
        (groupDivInset ~~ 0 and:[i ~~ size and:[self hasGroupDividerAt:i]]) ifTrue:[
1387
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2386
            layout := item layout.
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2387
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2388
            isVertical ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2389
                x1 := layout left.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2390
                x2 := layout right.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2391
                y1 := layout bottom + groupDivInset.
1387
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2392
                y2 := y1.
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2393
            ] ifFalse:[
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2394
                y1 := layout top.
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2395
                y2 := layout bottom.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2396
                x1 := layout right + groupDivInset.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2397
                x2 := x1.
1387
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2398
            ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2399
            self paint:shadowColor.
1387
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2400
            self displayLineFromX:x1 y:y1 toX:x2 y:y2.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2401
            self paint:lightColor.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2402
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2403
            isVertical ifTrue:[y1 := y1 + 1. y2 := y1 ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2404
                      ifFalse:[x1 := x1 + 1. x2 := x1 ].
1387
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2405
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2406
            self displayLineFromX:x1 y:y1 toX:x2 y:y2
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2407
        ]
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2408
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2409
    self clippingRectangle:prevClip.
1387
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2410
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2411
    "Modified: / 21.5.1999 / 20:14:07 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2412
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2413
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2414
!MenuPanel methodsFor:'enumerting & searching'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2415
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2416
collect:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2417
    "evaluate the argument, aOneArgBlock for every item in the menuPanel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2418
     and return a collection of the results
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2419
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2420
    items notNil ifTrue:[^ items collect:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2421
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2422
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2423
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2424
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2425
do:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2426
    "evaluate the argument, aOneArgBlock for every item in the menuPanel.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2427
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2428
    items notNil ifTrue:[ items do:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2429
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2430
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2431
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2432
findFirst:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2433
    "find the first item, for which evaluation of the argument, aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2434
     returns true; return its index or 0 if none detected.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2435
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2436
    items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2437
  ^ 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2438
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2439
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2440
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2441
findLast:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2442
    "find the last item, for which evaluation of the argument, aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2443
     returns true; return its index or 0 if none detected.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2444
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2445
    items notNil ifTrue:[ ^ items findLast:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2446
  ^ 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2447
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2448
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2449
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2450
indexOf:something
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2451
    "returns index of an item assigned to an index, nameKey, textLabel or value if symbol.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2452
     If no item match 0 is returned. No range checks are performed on a number argument
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2453
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2454
    |i v|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2455
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2456
    something isNumber ifTrue:[ ^ something ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2457
    something isNil    ifTrue:[ ^ 0 ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2458
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2459
    i := self findFirst:[:el | (el nameKey = something) or: [el = something]].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2460
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2461
    i ~~ 0 ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2462
	^ i
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2463
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2464
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2465
    something isSymbol ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2466
	i := self findFirst:[:el|
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2467
				v := el value.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2468
				v isSymbol and:[v == something]
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2469
			    ].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2470
	i ~~ 0 ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2471
	    ^ i
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2472
	]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2473
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2474
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2475
    (something respondsTo:#string) ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2476
	v := something string.
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2477
      ^ self findFirst:[:el | el textLabel = v].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2478
    ].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2479
    ^ 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2480
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2481
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2482
indexOfItem:anItem
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2483
    "returns the index of the item or 0
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2484
    "
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2485
    ^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0]
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2486
!
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2487
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2488
keysAndValuesDo:aTwoArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2489
    "evaluate the argument, aTwoArgBlock for every item in the menuPanel.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2490
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2491
    items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2492
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2493
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2494
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2495
!MenuPanel methodsFor:'event handling'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2496
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2497
buttonMotion:state x:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2498
    "open or close the corresponding submenus
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2499
    "
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2500
    |menue point sensor|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2501
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2502
    sensor := self sensor.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2503
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2504
    (sensor isNil or:[sensor hasButtonMotionEventFor:nil]) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2505
        ^ self
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2506
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2507
    menue := self detectGrabMenu.
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2508
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2509
    point := menue translateGrabPoint:(x@y).
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2510
    menue handleButtonMotion:state x:(point x) y:(point y).
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2511
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2512
    (self isPopUpView or:[sensor anyButtonPressed]) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2513
        ^ self
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2514
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2515
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2516
    (selection notNil and:[selection visibleSubmenu isNil]) ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2517
        "/ selection on grabView withou a submenu (Button ...); check whether moving out
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2518
        (self containsPointX:x y:y) ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2519
            ^ self accept:nil
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2520
        ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2521
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2522
1730
4936edfc2eee must enable motion events in #initialize (not in map)
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  2523
    "Modified: / 2.3.2000 / 21:51:16 / cg"
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2524
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2525
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2526
buttonPress:button x:x y:y
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2527
    "any button pressed; open or close the corresponding submenus
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2528
    "
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2529
    |srcPoint dstMenu dstPoint dstItem sensor|
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2530
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2531
    srcPoint := x@y.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2532
    dstMenu  := self detectMenuAtGrabPoint:srcPoint.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2533
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2534
    dstMenu isNil ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2535
        ^ self accept:nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2536
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2537
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2538
    dstPoint := dstMenu translateGrabPoint:srcPoint.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2539
    dstItem  := dstMenu itemAtX:(dstPoint x) y:(dstPoint y).
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2540
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2541
    dstMenu openMenuOnSelect:true.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2542
    dstMenu selection:dstItem.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2543
    dstMenu openMenuOnSelect:nil.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2544
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2545
    (     dstItem notNil
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2546
     and:[dstItem triggerOnDown
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2547
     and:[dstItem canAccept
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2548
     and:[dstItem == dstMenu selection]]]
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2549
    ) ifTrue:[
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2550
        dstMenu invalidateItem:dstItem repairNow:true.
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2551
        self acceptItem:dstItem inMenu:dstMenu.
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2552
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2553
        dstMenu selection == dstItem ifTrue:[
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2554
            (sensor := self sensor) notNil ifTrue:[
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2555
                [sensor anyButtonPressed] whileTrue:[ Delay waitForSeconds:0.1 ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2556
                sensor flushUserEvents.
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2557
            ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2558
            dstMenu selection:nil.
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2559
        ]
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2560
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2561
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2562
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2563
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2564
buttonRelease:button x:x y:y
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2565
    "button release action; accept selection and close all views
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2566
    "
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2567
    |topMenu dstMenu item srcPoint dstPoint|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2568
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2569
    topMenu := self topMenu.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2570
    dstMenu := topMenu activeMenu.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2571
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2572
    (    dstMenu selection notNil
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2573
     or:[dstMenu isPopUpView not
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2574
     or:[(OperatingSystem millisecondTimeDeltaBetween:(Time millisecondClockValue)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2575
         and:(dstMenu mapTime)) > 400]]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2576
    ) ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2577
        srcPoint := x@y.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2578
        
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2579
        (     (dstMenu := self detectMenuAtGrabPoint:srcPoint) notNil
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2580
         and:[(item    := dstMenu selection) notNil]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2581
        ) ifTrue:[
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2582
            item visibleSubmenu notNil ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2583
                dstMenu selection:nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2584
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2585
                (selection isNil and:[self isPopUpView not]) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2586
                    self accept:nil
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2587
                ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2588
            ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2589
                item currentSubmenu isNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2590
                    dstPoint := dstMenu translateGrabPoint:srcPoint.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2591
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2592
                    (dstMenu itemAtX:(dstPoint x) y:(dstPoint y)) == dstMenu selection ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2593
                        item := nil
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2594
                    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2595
                    topMenu acceptItem:item inMenu:dstMenu.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2596
                ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2597
            ].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2598
            ^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2599
        ].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2600
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2601
        (selection notNil and:[dstMenu == self]) ifTrue:[
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2602
            selection visibleSubmenu notNil ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2603
                ^ self
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2604
            ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2605
        ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2606
        self accept:nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2607
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2608
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2609
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2610
keyPress:key x:x y:y
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2611
    "any key is pressed
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2612
    "
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2613
    |menu rawKey|
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2614
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2615
       (key == #Tab 
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2616
    or:[key == #FocusNext
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2617
    or:[key == #FocusPrevious]]) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2618
        self accept:nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2619
      ^ super keyPress:key x:x y:y
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2620
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2621
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2622
    menu := self detectGrabMenu.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2623
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2624
    key == #Escape ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2625
        "/ must hide the active menu
1703
e127eff742bb bugfix: request focus
ca
parents: 1701
diff changeset
  2626
        ((menu := menu superMenu) notNil and:[menu ~~ self]) ifTrue:[
e127eff742bb bugfix: request focus
ca
parents: 1701
diff changeset
  2627
            "/ hide active menu but keep the grab
e127eff742bb bugfix: request focus
ca
parents: 1701
diff changeset
  2628
            menu selection:nil
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2629
        ] ifFalse:[
1703
e127eff742bb bugfix: request focus
ca
parents: 1701
diff changeset
  2630
            "/ hide active menu and ungrab
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2631
            self accept:nil
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2632
        ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2633
    ] ifFalse:[
1793
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  2634
        menu isViewWrapper ifFalse:[
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  2635
            self sensor compressKeyPressEventsWithKey:key.
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  2636
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  2637
            menu handleKeyPress:key.
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  2638
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2639
"/            selection isNil ifTrue:[
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2640
"/                self accept:nil keepValue:true
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2641
"/            ]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2642
        ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2643
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2644
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2645
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2646
pointerLeave:state
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2647
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2648
    self detectGrabMenu handlePointerLeave:state.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2649
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2650
    self isPopUpView ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2651
        ^ self
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2652
    ].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2653
    (selection notNil and:[selection visibleSubmenu isNil]) ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2654
        "/ selection on grabView withou a submenu (Button ...); check whether moving out
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2655
        self sensor anyButtonPressed ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2656
            ^ self accept:nil
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2657
        ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2658
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2659
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2660
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2661
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2662
sizeChanged:how
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2663
    "redraw #right groups
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2664
    "
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2665
    |index layout invRect w right|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2666
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2667
    (mustRearrange or:[self isPopUpView]) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2668
        ^ super sizeChanged:how
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2669
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2670
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2671
    index := self findFirst:[:anItem| anItem startGroup == #right ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2672
        
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2673
    index ~~ 0 ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2674
        (shown not or:[index == 1]) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2675
            self mustRearrange.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2676
        ] ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2677
            layout := (items at:(index -1)) layout.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2678
            right  := 1 + layout right.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2679
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2680
            (w := width - right) > margin ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2681
                invRect := Rectangle left:right top:0 width:w height:height.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2682
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2683
                items from:index do:[:anItem|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2684
                    anItem isVisible ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2685
                        layout := anItem layout.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2686
                        layout setLeft:right.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2687
                        right := layout right.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2688
                    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2689
                ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2690
                self rearrangeGroups.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2691
                self invalidate:invRect
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2692
            ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2693
        ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2694
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2695
    super sizeChanged:how
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2696
! !
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2697
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2698
!MenuPanel methodsFor:'event handling processing'!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2699
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2700
clearImplicitGrab
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2701
    self menuAdornmentAt:#implicitGrabView put:nil.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2702
    self menuAdornmentAt:#lastPointerView  put:nil.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2703
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2704
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2705
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2706
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2707
dispatchEvent:ev withFocusOn:focusView delegate:doDelegate
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2708
    "dispatch and handle an event
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2709
    "
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2710
    |view x y p syntheticEvent implicitGrabView lastPointerView menu|
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2711
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2712
    implicitGrabView := self menuAdornmentAt:#implicitGrabView.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2713
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2714
    "/ situation: we get a buttonPress, set implicitGrab (for scrollbars etc.)
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2715
    "/ but never get the buttonRelease, since someone else (a popUp) grabbed the
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2716
    "/ pointer in the meantime, and has eaten the release event ... (double-sigh)
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2717
    implicitGrabView notNil ifTrue:[
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2718
        self sensor leftButtonPressed ifFalse:[
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2719
            self clearImplicitGrab.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2720
        ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2721
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2722
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2723
    ((x := ev x) isNil or:[(y := ev y) isNil]) ifTrue:[
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2724
        ^ super dispatchEvent:ev withFocusOn:focusView delegate:false.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2725
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2726
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2727
    implicitGrabView notNil ifTrue:[
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2728
        ev isButtonEvent ifTrue:[
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2729
            p := device translatePoint:(x@y) from:(self id) to:(implicitGrabView id).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2730
            ev view:implicitGrabView.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2731
            ev arguments at:2 put:p x.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2732
            ev arguments at:3 put:p y.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2733
            implicitGrabView dispatchEvent:ev withFocusOn:focusView delegate:false.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2734
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2735
            ev isButtonReleaseEvent ifTrue:[
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2736
                self clearImplicitGrab.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2737
            ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2738
            ^ self
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2739
        ]
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2740
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2741
    menu := self detectMenuAtGrabPoint:(x@y).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2742
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2743
    (menu isNil or:[menu subViews size == 0]) ifTrue:[
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2744
        self clearImplicitGrab.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2745
      ^ super dispatchEvent:ev withFocusOn:focusView delegate:false
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2746
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2747
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2748
    p    := menu translateGrabPoint:(x@y).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2749
    view := self detectViewAtX:(p x) y:(p y) in:menu.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2750
    p    := device translatePoint:(x@y) from:(self id) to:(view id).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2751
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2752
    ev isButtonPressEvent ifTrue:[
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2753
        (view wantsFocusWithButtonPress) ifTrue:[
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2754
            view requestFocus.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2755
        ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2756
        view ~~ self ifTrue:[ "/ can this ever be self ?
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2757
            self menuAdornmentAt:#implicitGrabView put:view.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2758
        ]
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2759
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2760
    lastPointerView := self menuAdornmentAt:#lastPointerView.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2761
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2762
    ev isButtonMotionEvent ifTrue:[
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2763
        lastPointerView ~~ view ifTrue:[
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2764
            "/ must generate enter/leave ... (sigh)
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2765
            lastPointerView notNil ifTrue:[
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2766
                syntheticEvent := WindowEvent inputEvent
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2767
                                     for:lastPointerView
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2768
                                     type:#pointerLeave:
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2769
                                     arguments:(Array with:0).   "/ XXX: should be fixed
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2770
                lastPointerView dispatchEvent:syntheticEvent withFocusOn:nil delegate:false.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2771
            ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2772
            view notNil ifTrue:[
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2773
                syntheticEvent := WindowEvent inputEvent
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2774
                                     for:view
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2775
                                     type:#pointerEnter:x:y:
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2776
                                     arguments:(Array with:0 with:x with:y).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2777
                view dispatchEvent:syntheticEvent withFocusOn:nil delegate:false.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2778
            ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2779
            self menuAdornmentAt:#lastPointerView put:view.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2780
        ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2781
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2782
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2783
    ev view:view.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2784
    ev x:p x.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2785
    ev y:p y.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2786
    view dispatchEvent:ev withFocusOn:focusView delegate:false.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2787
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2788
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2789
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2790
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2791
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2792
handleButtonMotion:state x:x y:y
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2793
    "open or close the corresponding submenus
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2794
    "
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2795
    |menu point sel|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2796
1910
119f91172b70 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1902
diff changeset
  2797
    (state == 0 or:[self sensor anyButtonPressed not]) ifTrue:[
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2798
        "/ highlight enterItem if no selection exists
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2799
        selection isNil ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2800
            (self containsPointX:x y:y) ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2801
                ((sel := self itemAtX:x y:y) isNil or:[sel canSelect not]) ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2802
                    ^ self pointerEntersItem:nil
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2803
                ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2804
                (DefaultSelectionFollowsMouse and:[superMenu notNil]) ifTrue:[
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2805
                    self openMenuOnSelect:true.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2806
                    self selection:sel.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2807
                    self openMenuOnSelect:nil.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2808
                ] ifFalse:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2809
                    self pointerEntersItem:sel
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2810
                ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2811
                ^ self
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2812
            ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2813
        ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2814
        self pointerEntersItem:nil.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2815
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2816
        (DefaultSelectionFollowsMouse and:[(menu := self superMenuAtX:x y:y) notNil]) ifTrue:[
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2817
            point := self translateMenuPoint:(x@y) toMenu:menu.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2818
            sel   := menu itemAtX:(point x) y:(point y).
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2819
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2820
            (sel notNil and:[sel canSelect]) ifTrue:[
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2821
                menu openMenuOnSelect:true.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2822
                menu selection:sel.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2823
                menu openMenuOnSelect:nil.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2824
            ]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2825
        ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2826
      ^ self
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2827
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2828
    self pointerEntersItem:nil.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2829
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2830
    (menu := self superMenuAtX:x y:y) isNil ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2831
        self isPopUpView ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2832
            self selection:nil
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2833
        ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2834
        ^ self
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2835
    ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2836
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2837
    menu == self ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2838
        (sel := self itemAtX:x y:y) notNil ifTrue:[
1787
9bc818c591a9 buttonMotion: open menu if button pressed
ca
parents: 1786
diff changeset
  2839
            self openMenuOnSelect:true.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2840
            self selection:sel.
1787
9bc818c591a9 buttonMotion: open menu if button pressed
ca
parents: 1786
diff changeset
  2841
            self openMenuOnSelect:nil.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2842
        ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2843
    ] ifFalse:[
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2844
        point := self translateMenuPoint:(x@y) toMenu:menu.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2845
        sel   := menu itemAtX:(point x) y:(point y).
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2846
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2847
        (sel isNil and:[menu isPopUpView not]) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2848
            sel := menu selection.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2849
        ].
1787
9bc818c591a9 buttonMotion: open menu if button pressed
ca
parents: 1786
diff changeset
  2850
        menu openMenuOnSelect:true.
9bc818c591a9 buttonMotion: open menu if button pressed
ca
parents: 1786
diff changeset
  2851
        menu selection:sel.
9bc818c591a9 buttonMotion: open menu if button pressed
ca
parents: 1786
diff changeset
  2852
        menu openMenuOnSelect:nil.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2853
    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2854
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2855
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2856
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2857
handleCursorKey:aKey
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2858
    "handle a cursor key
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2859
    "
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2860
    |next menu item isVrt backKey p1 p2
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2861
     idx   "{ Class:SmallInteger }"
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  2862
     size  "{ Class:SmallInteger }"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2863
    |
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2864
    (size  := items size) == 0 ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2865
        superMenu notNil ifTrue:[superMenu handleCursorKey:aKey].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2866
      ^ self
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2867
    ].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2868
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2869
    isVrt := self verticalLayout.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2870
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2871
    (    (isVrt     and:[aKey == #CursorUp    or:[aKey == #CursorDown]])
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2872
     or:[(isVrt not and:[aKey == #CursorRight or:[aKey == #CursorLeft]])]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2873
    ) ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2874
        selection isNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2875
            (superMenu notNil and:[superMenu verticalLayout == isVrt]) ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2876
                ^ superMenu handleCursorKey:aKey
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2877
            ].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2878
            idx := 0
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2879
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2880
            idx := self indexOf:selection
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2881
        ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2882
        next := aKey == #CursorRight or:[aKey == #CursorDown].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2883
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2884
        size timesRepeat:[|el|
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2885
            next ifTrue:[(idx := idx + 1) > size ifTrue:[idx := 1]]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2886
                ifFalse:[(idx := idx - 1) < 1    ifTrue:[idx := size]].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2887
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2888
            (el := items at:idx ifAbsent:nil) notNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2889
                el canSelect ifTrue:[^ self selection:el]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2890
            ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2891
        ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2892
        ^ self
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2893
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2894
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2895
    superMenu notNil ifTrue:[
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2896
        p1 := self translateGrabPoint:0.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2897
        p2 := superMenu translateGrabPoint:0.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2898
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2899
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2900
    isVrt ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2901
        (superMenu notNil and:[p1 x > p2 x]) ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2902
            backKey := #CursorRight
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2903
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2904
            backKey := #CursorLeft.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2905
        ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2906
    ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2907
        (superMenu notNil and:[p1 y > p2 y]) ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2908
            backKey := #CursorDown
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2909
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2910
            backKey := #CursorUp.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2911
        ]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2912
    ].    
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2913
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2914
    aKey == backKey ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2915
        superMenu isNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2916
            self accept:nil
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2917
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2918
            superMenu verticalLayout ~~ isVrt ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2919
                superMenu handleCursorKey:aKey
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2920
            ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2921
                superMenu selection hideSubmenu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2922
            ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2923
        ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2924
        ^ self
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2925
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2926
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2927
    selection isNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2928
        superMenu isNil ifTrue:[^ self accept:nil].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2929
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2930
        superMenu verticalLayout ~~ isVrt ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2931
            superMenu handleCursorKey:aKey
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2932
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2933
            (item := items findFirst:[:el| el canSelect]) notNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2934
                self selection:item
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2935
            ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2936
        ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2937
        ^ self
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2938
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2939
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2940
    selection hasSubmenu ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2941
        (menu := selection visibleSubmenu) isNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2942
            selection toggleSubmenuVisibility
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2943
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2944
            menu selectionIndex:1
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2945
        ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2946
    ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2947
        superMenu notNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2948
            superMenu verticalLayout ~~ isVrt ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2949
                superMenu handleCursorKey:aKey
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2950
            ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2951
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2952
            self accept:nil
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2953
        ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2954
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2955
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2956
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2957
handleKeyPress:key
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2958
    "any key is pressed
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2959
    "
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2960
    |item inMenu rawKey|
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2961
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2962
    (key == #Return or:[key == Character space]) ifTrue:[
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2963
        self handleReturnPressed
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2964
    ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2965
        key isCharacter ifTrue:[
1862
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  2966
"/            selection notNil ifTrue:[
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  2967
"/                inMenu := self
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  2968
"/            ] ifFalse:[
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  2969
"/                (inMenu := superMenu) isNil ifTrue:[^ self].
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  2970
"/            ].
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  2971
            inMenu := self.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2972
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2973
            (item := inMenu detectItemForKey:key) notNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2974
                inMenu selection:item
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2975
            ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2976
        ] ifFalse:[
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2977
            (     key == #CursorDown or:[key == #CursorUp
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2978
              or:[key == #CursorLeft or:[key == #CursorRight]]]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2979
            ) ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2980
                self handleCursorKey:key
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2981
            ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2982
        ]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  2983
    ]
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  2984
!
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2985
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2986
handlePointerLeave:state
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2987
    self  pointerEntersItem:nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2988
    super pointerLeave:state
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2989
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2990
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2991
handleReturnPressed
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2992
    "any key is pressed
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2993
    "
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2994
    |sensor|
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2995
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2996
    selection isNil ifTrue:[
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2997
        superMenu notNil ifTrue:[
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2998
            superMenu selection toggleSubmenuVisibility
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2999
        ] ifFalse:[
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3000
            self accept
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3001
        ].
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3002
        ^ self
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3003
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3004
    selection hasSubmenu ifTrue:[
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3005
        ^ selection toggleSubmenuVisibility
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3006
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3007
    self accept.
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3008
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3009
    (selection notNil and:[selection triggerOnDown]) ifFalse:[
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3010
        ^ self
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3011
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3012
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3013
    (sensor := self sensor) isNil ifTrue:[
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3014
        ^ self
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3015
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3016
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3017
    [   sensor flushKeyboardFor:nil.
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3018
        Delay waitForSeconds:0.1.
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3019
        sensor hasKeyPressEventFor:nil.
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3020
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3021
    ] whileTrue.
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3022
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3023
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3024
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3025
pointerEntersItem:anItemOrNil
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3026
    "the pointer moves over an item or nil; restore the old item and
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3027
     redraw the new item highlighted.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3028
    "
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3029
    |oldItem newItem|
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3030
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3031
    (     anItemOrNil notNil
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3032
     and:[anItemOrNil canSelect
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3033
     and:[selection isNil
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3034
     and:[self isPopUpView not]]]) ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3035
        anItemOrNil isButton ifTrue:[
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3036
            (    buttonEnteredBgColor ~= ButtonPassiveBackgroundColor
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3037
             or:[ButtonEnteredLevel   ~~ ButtonPassiveLevel]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3038
            ) ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3039
                newItem := anItemOrNil
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3040
            ]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3041
        ] ifFalse:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3042
            DefaultEnteredLevel ~~ 0 ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3043
                newItem := anItemOrNil
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3044
            ]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3045
        ]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3046
    ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3047
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3048
    newItem ~~ enteredItem ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3049
        oldItem     := enteredItem.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3050
        enteredItem := newItem.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3051
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3052
        oldItem notNil ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3053
            self invalidateItem:oldItem repairNow:(enteredItem isNil).
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3054
        ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3055
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3056
        enteredItem notNil ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3057
            self invalidateItem:enteredItem repairNow:true.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3058
        ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3059
    ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3060
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3061
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3062
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3063
!MenuPanel methodsFor:'grabbing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3064
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3065
doGrab
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3066
    relativeGrabOrigin := nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3067
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3068
    superMenu notNil ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3069
        superMenu doGrab
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3070
    ] ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3071
        hasImplicitGrap ~~ true ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3072
            self grabMouseAndKeyboard.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3073
            hasImplicitGrap := true
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3074
        ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3075
    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3076
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3077
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3078
doUngrab:forceDo
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3079
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3080
    relativeGrabOrigin := nil.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3081
    self clearImplicitGrab.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3082
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3083
    superMenu notNil ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3084
        forceDo ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3085
            superMenu doUngrab:true
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3086
        ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3087
        ^ self
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3088
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3089
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3090
    hasImplicitGrap ~~ true ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3091
        ^ self
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3092
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3093
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3094
    forceDo ifFalse:[
1703
e127eff742bb bugfix: request focus
ca
parents: 1701
diff changeset
  3095
        (selection notNil or:[prevFocusView == self]) ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3096
            ^ self
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3097
        ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3098
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3099
    self ungrabMouseAndKeyboard.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3100
    self selection:nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3101
    hasImplicitGrap := nil.
1703
e127eff742bb bugfix: request focus
ca
parents: 1701
diff changeset
  3102
    prevFocusView   := nil.
e127eff742bb bugfix: request focus
ca
parents: 1701
diff changeset
  3103
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3104
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3105
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3106
grabKeyboard
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3107
    "grap the keyboard; keep previous grab
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3108
    "
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3109
    previousKeyboardGrab := device activeKeyboardGrab.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3110
  ^ super grabKeyboard
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3111
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3112
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3113
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3114
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3115
grabMouseAndKeyboard
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3116
    "get exclusive access to pointer and keyboard.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3117
    "
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3118
    |sensor|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3119
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3120
    realized ifTrue:[
1703
e127eff742bb bugfix: request focus
ca
parents: 1701
diff changeset
  3121
        prevFocusView := self windowGroup focusView.
1612
42e2fce5a1f9 set focus back
ca
parents: 1610
diff changeset
  3122
1575
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  3123
        sensor := self sensor.
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  3124
        device activePointerGrab ~~ self ifTrue:[
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  3125
            sensor notNil ifTrue:[
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  3126
                sensor flushMotionEventsFor:nil.
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  3127
            ].
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  3128
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3129
            (self grabPointer) ifFalse:[
1575
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  3130
                Delay waitForSeconds:0.1.
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3131
                (self grabPointer) ifFalse:[
1575
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  3132
                    "give up"
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  3133
                    'MenuPanel [warning]: could not grab pointer' errorPrintCR.
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  3134
                    self unmap
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  3135
                ]
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  3136
            ]
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  3137
        ].
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  3138
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  3139
        device activeKeyboardGrab ~~ self ifTrue:[
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  3140
            sensor notNil ifTrue:[
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  3141
                device sync.
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  3142
                sensor flushKeyboardFor:nil
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  3143
            ].
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3144
            self grabKeyboard.
1575
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  3145
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3146
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3147
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3148
    "Modified: / 2.2.1998 / 23:43:59 / stefan"
1254
38b8bcfabbd7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1253
diff changeset
  3149
    "Modified: / 15.3.1999 / 12:01:38 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3150
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3151
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3152
grabPointerWithCursor:aCursorOrNil
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3153
    "grap the pointer; keep previous grab
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3154
    "
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3155
    previousPointerGrab := device activePointerGrab.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3156
    hasImplicitGrap := true.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3157
  ^ super grabPointerWithCursor:aCursorOrNil
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3158
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3159
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3160
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3161
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3162
ungrabKeyboard
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3163
    "ungrap the keyboard; restore previous grab
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3164
    "
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3165
    super ungrabKeyboard.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3166
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3167
    previousKeyboardGrab notNil ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3168
        device grabKeyboardInView:previousKeyboardGrab.
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3169
    ].
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3170
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3171
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3172
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3173
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3174
ungrabMouseAndKeyboard
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3175
    "ungrab resources (mouse and keyboard)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3176
    "
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3177
    self ungrabPointer.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3178
    self ungrabKeyboard.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3179
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3180
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3181
ungrabPointer
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3182
    "ungrap the pointer; restore previous grab
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3183
    "
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3184
    super ungrabPointer.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3185
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3186
    previousPointerGrab notNil ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3187
        device grabPointerInView:previousPointerGrab.
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3188
    ].
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3189
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3190
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3191
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3192
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  3193
!MenuPanel methodsFor:'help'!
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  3194
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  3195
helpText
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3196
    "return the helpText for the currently selected item (empty if none)
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3197
    "
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3198
    ^ self helpTextForItem:selection
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  3199
!
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  3200
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3201
helpTextAt:srcPoint
1252
6db6906da49b debug print
Claus Gittinger <cg@exept.de>
parents: 1251
diff changeset
  3202
    "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
  3203
     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
  3204
     "
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3205
    |dstMenu dstPoint|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3206
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3207
    dstMenu := self detectMenuAtGrabPoint:srcPoint.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3208
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3209
    dstMenu isNil ifTrue:[
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3210
        ^ ''
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3211
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3212
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3213
    dstPoint := dstMenu translateGrabPoint:srcPoint.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3214
  ^ dstMenu helpTextForItem:(dstMenu itemAtX:(dstPoint x) y:(dstPoint y)).
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3215
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3216
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3217
helpTextForItem:anItem
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3218
    "returns the helpText for an item (empty if none)
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3219
    "
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3220
    |key val app|
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3221
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3222
    anItem isNil ifTrue:[^ ''].
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3223
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3224
    (val := anItem activeHelpText) isNil ifTrue:[
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3225
        (     (key := anItem activeHelpKey) notNil
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3226
         and:[(app := self application) notNil]
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3227
        ) ifTrue:[
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3228
            val := app helpTextForKey:key.
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3229
        ].
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3230
        anItem activeHelpText:(val ? '').
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3231
    ].
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3232
    ^ val
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3233
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  3234
! !
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  3235
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3236
!MenuPanel methodsFor:'image registration'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3237
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3238
imageOnDevice:anImage
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3239
    "returns image registered on device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3240
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3241
    ^ self class image:anImage onDevice:device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3242
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3243
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3244
lightenedImageOnDevice:anImage
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3245
    "returns lightened image registered on device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3246
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3247
    ^ self class lightenedImage:anImage onDevice:device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3248
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3249
1688
271829d6a2e4 category changes
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  3250
!MenuPanel methodsFor:'initialization & release'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3251
767
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  3252
addToCurrentProject
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  3253
    "ignored here"
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  3254
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  3255
    ^self
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  3256
!
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  3257
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3258
create
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3259
    "create the shadow view for a none contained submenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3260
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3261
    super create.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3262
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3263
    self isPopUpView ifTrue:[
1499
07951b17b43e allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  3264
        (PopUpView shadowsOnDevice:device) ifTrue:[
07951b17b43e allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  3265
            shadowView isNil ifTrue:[
07951b17b43e allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  3266
                shadowView := (ShadowView onDevice:device) for:self
07951b17b43e allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  3267
            ] ifFalse:[
07951b17b43e allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  3268
                self saveUnder:true.
07951b17b43e allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  3269
            ].
07951b17b43e allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  3270
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3271
    ] ifFalse:[
1499
07951b17b43e allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  3272
        explicitExtent == true ifTrue:[
07951b17b43e allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  3273
            (self width) == (superView width) ifTrue:[
07951b17b43e allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  3274
                self verticalLayout:false
07951b17b43e allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  3275
            ]
07951b17b43e allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  3276
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3277
    ]
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  3278
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  3279
    "Modified: / 28.7.1998 / 02:11:44 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3280
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3281
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3282
destroy
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3283
    "destroy items and shadowView; remove dependencies
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3284
    "
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3285
    self clearLastActiveMenu.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3286
    self do:[:el|el destroy].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3287
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3288
    menuHolder    notNil ifTrue:[menuHolder    removeDependent:self].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3289
    enableChannel notNil ifTrue:[enableChannel removeDependent:self].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3290
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3291
    super destroy.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3292
    superMenu := nil.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3293
    items     := nil.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3294
    shadowView notNil ifTrue:[shadowView destroy].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3295
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3296
    "Modified: / 27.2.1998 / 17:41:25 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3297
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3298
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3299
fetchDeviceResources
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3300
    "fetch device colors, to avoid reallocation at redraw time"
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3301
1735
941d5de7372c fix some warnings durring compilation
ca
parents: 1734
diff changeset
  3302
    |bw lvl|
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3303
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3304
    super fetchDeviceResources.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3305
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  3306
    "/ 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
  3307
    "/ (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
  3308
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  3309
    onLevel := styleSheet at:#'menu.hilightLevel' default:0.
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  3310
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3311
    self isPopUpView ifTrue:[
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3312
        bw  := styleSheet at:#'popup.borderWidth' default:1.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3313
        lvl := styleSheet at:#'popup.level'       default:0.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3314
    ] ifFalse:[
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3315
        bw  := styleSheet is3D ifFalse:[1] ifTrue:[0].
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3316
    ].
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3317
    self borderWidth:bw.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3318
    self level:lvl.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3319
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3320
    superMenu isNil ifTrue:[
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3321
        fgColor                   := DefaultForegroundColor         onDevice:device.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3322
        activeBgColor             := DefaultHilightBackgroundColor  onDevice:device.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3323
        activeFgColor             := DefaultHilightForegroundColor  onDevice:device.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3324
        disabledFgColor           := DefaultDisabledForegroundColor onDevice:device.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3325
        rightArrow                := RightArrowForm                 onDevice:device.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3326
        selectionFrameBrightColor := SelectionFrameBrightColor      onDevice:device.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3327
        selectionFrameDarkColor   := SelectionFrameDarkColor        onDevice:device.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3328
        buttonLightColor          := ButtonLightColor               onDevice:device.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3329
        buttonShadowColor         := ButtonShadowColor              onDevice:device.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3330
        ButtonHalfLightColor notNil ifTrue: [
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3331
            buttonHalfLightColor      := ButtonHalfLightColor           onDevice:device].
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3332
        ButtonHalfShadowColor notNil ifTrue: [
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3333
            buttonHalfShadowColor     := ButtonHalfShadowColor          onDevice:device].
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3334
        buttonEnteredBgColor      := ButtonEnteredBackgroundColor   onDevice:device.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3335
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3336
        (rightArrowShadow := RightArrowShadowForm) notNil ifTrue:[
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3337
            rightArrowShadow := rightArrowShadow onDevice:device
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3338
        ]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3339
    ] ifFalse:[
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3340
        fgColor                   := superMenu foregroundColor.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3341
        activeBgColor             := superMenu activeBackgroundColor.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3342
        activeFgColor             := superMenu activeForegroundColor.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3343
        disabledFgColor           := superMenu disabledForegroundColor.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3344
        rightArrow                := superMenu rightArrow.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3345
        rightArrowShadow          := superMenu rightArrowShadow.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3346
        selectionFrameBrightColor := superMenu selectionFrameBrightColor.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3347
        selectionFrameDarkColor   := superMenu selectionFrameDarkColor.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3348
        buttonLightColor          := superMenu buttonLightColor.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3349
        buttonShadowColor         := superMenu buttonShadowColor.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3350
        buttonHalfLightColor      := superMenu buttonHalfLightColor.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3351
        buttonHalfShadowColor     := superMenu buttonHalfShadowColor.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3352
        buttonEnteredBgColor      := superMenu buttonEnteredBackgroundColor.
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  3353
    ].
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  3354
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  3355
    items notNil ifTrue:[
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  3356
        items do:[:eachItem |
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  3357
            eachItem fetchDeviceResources
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  3358
        ]
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  3359
    ].
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  3360
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  3361
    "Modified: / 15.9.1998 / 12:51:29 / cg"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3362
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3363
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3364
initStyle
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3365
    "initialize style specific stuff"
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3366
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3367
    super initStyle.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3368
1336
6087005f59a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1332
diff changeset
  3369
    viewBackground := DefaultBackgroundColor.
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3370
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3371
    onLevel          := DefaultHilightLevel.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3372
    offLevel         := 0. "/ DefaultLevel.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3373
    itemSpace        := DefaultItemSpace.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3374
    groupDividerSize := DefaultGroupDividerSize.
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3375
    fitFirstPanel    := false.
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  3376
    font             := MenuView defaultFont onDevice:device.
1923
530426a3d692 support #level:
ca
parents: 1922
diff changeset
  3377
530426a3d692 support #level:
ca
parents: 1922
diff changeset
  3378
    super level:(styleSheet is3D ifTrue:[1] ifFalse:[0]).
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3379
!
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3380
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3381
initialize
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3382
    "set default configuration
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3383
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3384
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3385
    super initialize.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3386
1730
4936edfc2eee must enable motion events in #initialize (not in map)
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3387
    self enableMotionEvents.
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3388
    enabled := true.
1877
3b415fa4710f only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents: 1874
diff changeset
  3389
    self extentChangedFlag:false.
3b415fa4710f only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents: 1874
diff changeset
  3390
    self originChangedFlag:false.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3391
    explicitExtent := nil.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3392
    shortKeyInset  := 0.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3393
    mustRearrange  := false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3394
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3395
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  3396
map
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3397
    "grab the pointer here, when visible (but not if control has already been lost). 
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3398
     If the grab fails, try again and unmap myself if that fails too.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3399
    "
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3400
    |loIndices loItems|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3401
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3402
    enteredItem := nil.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3403
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  3404
    self enableMotionEvents.
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3405
    self becomesActiveMenu.
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  3406
    super map.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3407
1785
efa4cc8ca917 mnemonic behaviour changed
ca
parents: 1775
diff changeset
  3408
    loIndices := InitialSelectionQuerySignal query.
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3409
    loItems   := items ? #[].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3410
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3411
    loItems do:[:anItem| anItem fetchImages ].
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3412
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3413
    self isPopUpView ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3414
        self doGrab
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3415
    ] ifFalse:[
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3416
        super viewBackground:(self backgroundColor).
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3417
    ].
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3418
    loItems do:[:el| el updateIndicators ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3419
1785
efa4cc8ca917 mnemonic behaviour changed
ca
parents: 1775
diff changeset
  3420
    loIndices size > 0 ifTrue:[
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3421
        self redrawX:0 y:0 width:width height:height.
1785
efa4cc8ca917 mnemonic behaviour changed
ca
parents: 1775
diff changeset
  3422
        self openMenusFromItemIndices:loIndices.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3423
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3424
1177
cfd7f71639f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1164
diff changeset
  3425
    "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
  3426
    "Modified: / 18.3.1999 / 18:22:18 / stefan"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3427
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3428
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3429
realize
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3430
    "realize menu and shadowView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3431
    "
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3432
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3433
    self isPopUpView ifTrue:[
1459
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  3434
        "Because of #saveUnder of ShadowView the order of realize is significant:
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  3435
         shadowView must be realized before self"
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  3436
        self hiddenOnRealize:true.
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  3437
        super realize.
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  3438
        self resize.
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  3439
        self makeFullyVisible.
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  3440
        shadowView notNil ifTrue:[
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  3441
            shadowView realize.
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  3442
        ].
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  3443
        self raise.
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  3444
        self map.
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3445
    ] ifFalse:[
1459
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  3446
        super realize.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3447
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3448
    self allSubViewsDo:[:aView| aView realize ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3449
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3450
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3451
recreate
1832
f6e6640e99a3 comment
Claus Gittinger <cg@exept.de>
parents: 1829
diff changeset
  3452
    "this is called after a snapin or a migration.
f6e6640e99a3 comment
Claus Gittinger <cg@exept.de>
parents: 1829
diff changeset
  3453
     If the image was saved with an active menu, hide the menu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3454
    "
1455
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  3455
    selection := nil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3456
    super recreate.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3457
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3458
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3459
reinitStyle
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3460
    "handle style change while being open (win32 only - for now)"
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3461
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3462
    super reinitStyle.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3463
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3464
    self fetchDeviceResources.
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  3465
    self mustRearrange.      "/ care for changed font sizes etc.
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  3466
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  3467
    self do:[:anItem |
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  3468
        anItem reinitStyle
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  3469
    ].
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3470
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3471
    "Created: / 10.9.1998 / 21:37:05 / cg"
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  3472
    "Modified: / 17.8.2000 / 18:01:33 / cg"
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3473
!
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3474
1796
c9d801c011f7 recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  3475
reinitialize
c9d801c011f7 recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  3476
    "reinit after a snapIn
c9d801c011f7 recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  3477
    "
c9d801c011f7 recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  3478
c9d801c011f7 recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  3479
    super reinitialize.
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  3480
"/    self reinitStyle.
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  3481
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  3482
    "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
  3483
!
c9d801c011f7 recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  3484
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3485
unmap
1330
63d2fe5ebd48 comment
Claus Gittinger <cg@exept.de>
parents: 1313
diff changeset
  3486
    "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
  3487
     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
  3488
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3489
    self clearLastActiveMenu.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3490
    self doUngrab:(superMenu isNil).
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3491
"/    self isPopUpView ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3492
"/         self doUngrab:(superMenu isNil)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3493
"/    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3494
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3495
    super unmap.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3496
    shadowView notNil ifTrue:[shadowView unmap].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3497
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3498
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3499
!MenuPanel methodsFor:'keyboard control'!
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3500
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3501
mnemonicViewNext:aKeyEvent
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3502
    "a  mnemonicKey event as forwarded from the keyboardProcessor - if there
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3503
     is the mnemonic-key defined for any menuItem, handle the menuItem and
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3504
     return the topMenu otherwise nil.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3505
    "
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3506
    |menu uKey lKey list|
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3507
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3508
    superMenu notNil ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3509
        ^ superMenu mnemonicViewNext:aKeyEvent
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3510
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3511
    shown ifFalse:[^ nil].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3512
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3513
    uKey := aKeyEvent rawKey last asUppercase.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3514
    lKey := uKey asLowercase.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3515
    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
  3516
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3517
    [true] whileTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3518
        list := menu selectItemIndicesFor:[:el||k|k := el accessCharacter. k == uKey or:[k == lKey]]
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3519
                                 maxDepth:10.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3520
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3521
        list size ~~ 0 ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3522
            "/ has item which responds to the mnemonic
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3523
            menu processCollectedIndices:list.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3524
          ^ self
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3525
        ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3526
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3527
        menu == self ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3528
            "/ must clear existing selection
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3529
            self selection:nil.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3530
          ^ nil
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3531
        ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3532
        menu := self.
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3533
    ].
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3534
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3535
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3536
openMenusFromItemIndices:anItemIndiceList
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3537
    "open all menus derived from sequence of item indices
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3538
    "
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3539
    |item|
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3540
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3541
    anItemIndiceList size == 0 ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3542
        ^ self
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3543
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3544
    item := self itemAt:(anItemIndiceList removeFirst).
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3545
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3546
    (item notNil and:[item enabled]) ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3547
        InitialSelectionQuerySignal answer:anItemIndiceList do:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3548
            self openMenuOnSelect:true.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3549
            self selection:item.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3550
            self openMenuOnSelect:nil.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3551
        ]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3552
    ].
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3553
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3554
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3555
processCollectedIndices:indices
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3556
    |menu item|
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3557
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3558
    indices size == 0 ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3559
        ^ self
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3560
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3561
    menu := self.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3562
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3563
    [menu selectionIndex == indices first] whileTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3564
        (    (item := menu selection) isNil             "/ shouldn't happen
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3565
         or:[(menu := item submenu) isNil]              "/ no more indices; done
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3566
        ) ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3567
            ^ true
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3568
        ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3569
        indices removeFirst.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3570
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3571
        indices isEmpty ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3572
           menu selection:nil.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3573
         ^ self
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3574
        ]
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3575
    ].
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3576
    menu openMenusFromItemIndices:indices.
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3577
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3578
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3579
processShortcut:aKeyEvent
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3580
    "a  shortcutKey event as forwarded from the keyboardProcessor - if there is the
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3581
     shortcut-key defined process the shortcut and return true otherwise false.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3582
    "
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3583
    |menu rKey lKey list item winGroup|
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3584
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3585
    superMenu notNil ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3586
        ^ superMenu processShortcut:aKeyEvent
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3587
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3588
    shown ifFalse:[^ false].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3589
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3590
    item := nil.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3591
    rKey := aKeyEvent rawKey.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3592
    lKey := aKeyEvent key.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3593
    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
  3594
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3595
    [true] whileTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3596
        list := menu selectItemIndicesFor:[:el||skey|
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3597
                                                item := el.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3598
                                                skey := el shortcutKey.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3599
                                                skey == rKey or:[skey == lKey]
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3600
                                          ]
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3601
                                 maxDepth:10.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3602
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3603
        list size ~~ 0 ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3604
            "/ has item which responds to the shortcut
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3605
            item hasSubmenu ifFalse:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3606
                menu accept:item
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3607
            ] ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3608
                menu processCollectedIndices:list.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3609
                self windowGroup focusView:self.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3610
            ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3611
          ^ true
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3612
        ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3613
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3614
        menu == self ifTrue:[ ^ false ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3615
        menu := self.
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3616
    ].
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3617
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3618
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3619
selectItemIndicesFor:aOneArgBlock maxDepth:maxDepth
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3620
    "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
  3621
     returns true. The first entry is the topmenu, the last entry the
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3622
     item for which the block returns true.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3623
     If no item is detected, nil is returned
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3624
    "
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3625
    (maxDepth <= 0 or:[items isNil]) ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3626
        ^ nil
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3627
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3628
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3629
    "/ first search horizontal
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3630
    items keysAndValuesDo:[:anIdx :anItem|
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3631
        (aOneArgBlock value:anItem) ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3632
            (anItem isEnabled and:[anItem isVisible]) ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3633
                ^ OrderedCollection with:anIdx.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3634
            ]
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3635
        ]
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3636
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3637
    "/ search in subMenus
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3638
    items keysAndValuesDo:[:anIdx :anItem| |menu seq|
1919
26fa92fa9465 only search submenus for shortCuts if the menu is a static one
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
  3639
        (anItem hasSubmenu
26fa92fa9465 only search submenus for shortCuts if the menu is a static one
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
  3640
         and:[anItem isVisible 
26fa92fa9465 only search submenus for shortCuts if the menu is a static one
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
  3641
         and:[anItem isEnabled]]) ifTrue:[
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3642
            menu := anItem submenu.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3643
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3644
            (menu notNil and:[menu isEnabled]) ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3645
                seq := menu selectItemIndicesFor:aOneArgBlock maxDepth:(maxDepth - 1).
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3646
                seq notNil ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3647
                    seq addFirst:anIdx.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3648
                  ^ seq
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3649
                ]
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3650
            ]
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3651
        ]
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3652
    ].
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3653
    ^ nil
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3654
! !
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3655
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3656
!MenuPanel methodsFor:'misc'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3657
427
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  3658
raiseDeiconified
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  3659
    ^ self raise
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  3660
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  3661
    "Created: 21.6.1997 / 13:29:12 / cg"
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  3662
!
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  3663
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3664
superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3665
    "returns supermenu or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3666
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3667
    ^ superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3668
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3669
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3670
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3671
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3672
superMenu:aSuperMenu
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  3673
    "set my supermenu from which i'am activated
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  3674
    "
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  3675
    (superMenu := aSuperMenu) notNil ifTrue:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  3676
        super font:(superMenu font)
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  3677
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3678
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3679
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3680
topMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3681
    "returns the topMenu; the one having no superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3682
    "
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3683
    |menu smenu|
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3684
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3685
    menu := self.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3686
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3687
    [(smenu := menu superMenu) notNil] whileTrue:[
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3688
        menu := smenu
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3689
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3690
    ^ menu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3691
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3692
1825
962390f1b499 category change
Claus Gittinger <cg@exept.de>
parents: 1824
diff changeset
  3693
!MenuPanel methodsFor:'printing & storing'!
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3694
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3695
printString
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3696
    "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
  3697
    "
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3698
    |string label|
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3699
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3700
    string := 'Menu:'.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3701
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3702
    self do:[:anItem|
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3703
	label  := anItem label ? ''.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3704
	string := string ,' ', label printString.
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3705
    ].
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3706
    ^ string
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3707
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3708
    "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
  3709
! !
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3710
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3711
!MenuPanel methodsFor:'private'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3712
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3713
application
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3714
    "optimize access to retrive the application
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3715
    "
1921
f3f120d43849 oops - handle query for application, when view is already closed.
Claus Gittinger <cg@exept.de>
parents: 1919
diff changeset
  3716
    |appl akey w views|
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3717
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3718
    superMenu notNil ifTrue:[
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3719
        ^ superMenu application
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3720
    ].
1870
ba2f5f6b5005 avoid recursive runaway in #applciation
ca
parents: 1864
diff changeset
  3721
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3722
    akey := #appl.
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3723
    appl := self menuAdornmentAt:akey.
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3724
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3725
    appl isNil ifTrue:[
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3726
        (appl := super application) isNil ifTrue:[
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3727
            windowGroup isNil ifTrue:[
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3728
                ^ nil   "/ RETRY LATER
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3729
            ].
1921
f3f120d43849 oops - handle query for application, when view is already closed.
Claus Gittinger <cg@exept.de>
parents: 1919
diff changeset
  3730
            views := windowGroup mainGroup topViews.
f3f120d43849 oops - handle query for application, when view is already closed.
Claus Gittinger <cg@exept.de>
parents: 1919
diff changeset
  3731
            views size == 0 ifTrue:[
f3f120d43849 oops - handle query for application, when view is already closed.
Claus Gittinger <cg@exept.de>
parents: 1919
diff changeset
  3732
                ^ nil   "/ RETRY LATER
f3f120d43849 oops - handle query for application, when view is already closed.
Claus Gittinger <cg@exept.de>
parents: 1919
diff changeset
  3733
            ].
f3f120d43849 oops - handle query for application, when view is already closed.
Claus Gittinger <cg@exept.de>
parents: 1919
diff changeset
  3734
            w := views first.
1870
ba2f5f6b5005 avoid recursive runaway in #applciation
ca
parents: 1864
diff changeset
  3735
            w == self ifTrue:[
1872
b20e27632fd8 application fetch fix
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3736
                thisContext isRecursive ifTrue:[
b20e27632fd8 application fetch fix
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3737
                    self error:'recursive application query'
b20e27632fd8 application fetch fix
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3738
                ].
b20e27632fd8 application fetch fix
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3739
                "/ appl := akey
1870
ba2f5f6b5005 avoid recursive runaway in #applciation
ca
parents: 1864
diff changeset
  3740
            ].
1872
b20e27632fd8 application fetch fix
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3741
            appl := (w application) ? akey.
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3742
        ].
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3743
        self menuAdornmentAt:akey put:appl
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3744
    ].
1872
b20e27632fd8 application fetch fix
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3745
    ^ appl ~~ akey ifTrue:[appl] ifFalse:[nil]
b20e27632fd8 application fetch fix
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3746
!
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3747
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3748
detectItemForKey:aKey
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3749
    "returns the item assigned to a key, accessCharacter or starts with.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3750
     if no item is detected nil is returned.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3751
    "
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3752
    |cIdx uKey lKey item|
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3753
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3754
    items isNil ifTrue:[^ nil].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3755
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3756
    cIdx := self selectionIndex.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3757
    uKey := aKey asUppercase.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3758
    lKey := aKey asLowercase.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3759
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3760
    items keysAndValuesDo:[:anIndex :anItem| |char label|
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3761
        (     anIndex ~~ cIdx
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3762
         and:[anItem canSelect
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3763
         and:[(label := anItem textLabel) notNil
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3764
         and:[label size ~~ 0]]]
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3765
        ) ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3766
            (char := anItem accessCharacter) notNil ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3767
                (char == uKey or:[char == lKey]) ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3768
                    ^ anItem
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3769
                ]
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3770
            ] ifFalse:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3771
                char := label at:1.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3772
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3773
                (char == uKey or:[char == lKey]) ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3774
                    anIndex > cIdx ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3775
                        ^ anItem
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3776
                    ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3777
                    item isNil ifTrue:[item := anItem]
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3778
                ]
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3779
            ]
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3780
        ]
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3781
    ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3782
    ^ item
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3783
!
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3784
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3785
menuAdornmentAt:aSymbol
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3786
    "returns a value derived from adornment
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3787
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3788
    |adm|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3789
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3790
    adm := adornment ? DefaultAdornment.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3791
  ^ adm at:aSymbol ifAbsent:nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3792
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3793
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3794
menuAdornmentAt:aSymbol put:something
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  3795
    "sets a value for the specific menu; if the value differs to the
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  3796
     current stored value, true is returned otherwise false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3797
    "
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  3798
    (self menuAdornmentAt:aSymbol) == something ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3799
	^ false
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  3800
    ].
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  3801
    adornment isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3802
	adornment := DefaultAdornment copy
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  3803
    ].
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  3804
    adornment at:aSymbol put:something.
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  3805
  ^ true
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3806
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3807
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3808
onEachPerform:aSelector withArgList:aList
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3809
    "on each item perform selector with an argument derived from aList
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3810
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3811
    aList isCollection ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3812
	items size >= aList size ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3813
	    aList keysAndValuesDo:[:anIndex :anArg|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3814
		(items at:anIndex) perform:aSelector with:anArg
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3815
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3816
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3817
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3818
	self do:[:anItem| anItem perform:aSelector with:aList ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3819
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3820
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3821
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3822
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3823
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  3824
registerImageOnDevice:anImage
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  3825
    |image|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  3826
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  3827
    (image := anImage) notNil ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  3828
        image device ~~ device ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  3829
            image := image copy.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  3830
        ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  3831
        image := image on:device.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  3832
        image := image clearMaskedPixels.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  3833
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  3834
    ^ image
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3835
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3836
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3837
!MenuPanel methodsFor:'private activation'!
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3838
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3839
activeMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3840
    "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
  3841
    "
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3842
    ^ lastActiveMenu ? self
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3843
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3844
    "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
  3845
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3846
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3847
activeMenu:aMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3848
    "set the current active menu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3849
    "
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3850
    lastActiveMenu := aMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3851
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3852
    "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
  3853
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3854
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3855
becomesActiveMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3856
    "submenu becomes the active menu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3857
    "
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3858
    mapTime := Time millisecondClockValue.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3859
    self topMenu activeMenu:self.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3860
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3861
    "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
  3862
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3863
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3864
clearLastActiveMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3865
    "reset the current active menu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3866
    "
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3867
    |top|
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3868
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3869
    top := self topMenu.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3870
1612
42e2fce5a1f9 set focus back
ca
parents: 1610
diff changeset
  3871
    prevFocusView notNil ifTrue:[
42e2fce5a1f9 set focus back
ca
parents: 1610
diff changeset
  3872
        self windowGroup focusView:prevFocusView.
42e2fce5a1f9 set focus back
ca
parents: 1610
diff changeset
  3873
        prevFocusView := nil.
42e2fce5a1f9 set focus back
ca
parents: 1610
diff changeset
  3874
    ].
42e2fce5a1f9 set focus back
ca
parents: 1610
diff changeset
  3875
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3876
    top activeMenu == self ifTrue:[
1612
42e2fce5a1f9 set focus back
ca
parents: 1610
diff changeset
  3877
        top activeMenu:nil
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3878
    ]
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3879
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3880
    "Created: / 27.2.1998 / 17:41:17 / cg"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3881
!
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3882
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3883
mapTime
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3884
    "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
  3885
    "
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3886
    ^ mapTime
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3887
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3888
    "Modified: / 27.2.1998 / 17:41:18 / cg"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3889
! !
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3890
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3891
!MenuPanel methodsFor:'private searching'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3892
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3893
detectGrabMenu
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3894
    "returns the menu which is responsible for the grap; the last opened menu
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3895
    "
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3896
    |subMenu|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3897
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3898
    selection notNil ifTrue:[
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3899
        (subMenu := selection visibleSubmenu) notNil ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3900
            ^ subMenu detectGrabMenu
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3901
        ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3902
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3903
    ^ self
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3904
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3905
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3906
detectMenuAtGrabPoint:aGrabPoint
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3907
    "returns the menu which contains the grab-point
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3908
    "
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3909
    |dstMenu dstPoint firstMenu|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3910
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3911
    dstPoint := self translateGrabPoint:aGrabPoint.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3912
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3913
    ((dstPoint x between:0 and:width) and:[dstPoint y between:0 and:height]) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3914
        firstMenu := self.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3915
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3916
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3917
    (selection isNil or:[(dstMenu := selection visibleSubmenu) isNil]) ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3918
        ^ firstMenu
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3919
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3920
    dstMenu := dstMenu detectMenuAtGrabPoint:aGrabPoint.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3921
  ^ dstMenu ? firstMenu
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3922
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3923
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3924
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3925
detectViewAtX:x y:y in:aTopView
1922
1a2ab52eb2ab bug fix in #detectViewAtX:y:in:
ca
parents: 1921
diff changeset
  3926
    "detect view at x@y
1a2ab52eb2ab bug fix in #detectViewAtX:y:in:
ca
parents: 1921
diff changeset
  3927
    "
1a2ab52eb2ab bug fix in #detectViewAtX:y:in:
ca
parents: 1921
diff changeset
  3928
    |p subViews|
1a2ab52eb2ab bug fix in #detectViewAtX:y:in:
ca
parents: 1921
diff changeset
  3929
1a2ab52eb2ab bug fix in #detectViewAtX:y:in:
ca
parents: 1921
diff changeset
  3930
    (subViews := aTopView subViews) notNil ifTrue:[
1a2ab52eb2ab bug fix in #detectViewAtX:y:in:
ca
parents: 1921
diff changeset
  3931
        subViews do:[:v| |p|
1a2ab52eb2ab bug fix in #detectViewAtX:y:in:
ca
parents: 1921
diff changeset
  3932
            v shown ifTrue:[
1a2ab52eb2ab bug fix in #detectViewAtX:y:in:
ca
parents: 1921
diff changeset
  3933
                (    (x between:(v left) and:(v right))
1a2ab52eb2ab bug fix in #detectViewAtX:y:in:
ca
parents: 1921
diff changeset
  3934
                 and:[y between:(v top)  and:(v bottom)]
1a2ab52eb2ab bug fix in #detectViewAtX:y:in:
ca
parents: 1921
diff changeset
  3935
                ) ifTrue:[
1a2ab52eb2ab bug fix in #detectViewAtX:y:in:
ca
parents: 1921
diff changeset
  3936
                    p := device translatePoint:(x@y) from:(aTopView id) to:(v id).
1a2ab52eb2ab bug fix in #detectViewAtX:y:in:
ca
parents: 1921
diff changeset
  3937
                  ^ self detectViewAtX:p x y:p y in:v.
1a2ab52eb2ab bug fix in #detectViewAtX:y:in:
ca
parents: 1921
diff changeset
  3938
                ]
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3939
            ]
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3940
        ]
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3941
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3942
    ^ aTopView
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3943
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3944
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3945
itemAtX:x y:y
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3946
    "returns the item at a point x@y or nil if none detected
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3947
    "
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3948
    items notNil ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3949
        ^ items detect:[:el| el containsPointX:x y:y] ifNone:nil
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3950
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3951
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3952
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3953
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3954
superMenuAtX:x y:y
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3955
    "returns the superMenu which contains the point x@y or nil if none detected
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3956
    "
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3957
    |grabPoint superMenu|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3958
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3959
    (self containsPointX:x y:y) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3960
        ^ self
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3961
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3962
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3963
    grabPoint := (x@y) - (self translateGrabPoint:0).
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3964
    superMenu := self.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3965
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3966
    [ (superMenu := superMenu superMenu) notNil ] whileTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3967
        (superMenu containsPoint:(superMenu translateGrabPoint:grabPoint)) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3968
            ^ superMenu
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3969
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3970
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3971
  ^ nil
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3972
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3973
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3974
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3975
!MenuPanel methodsFor:'queries'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3976
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3977
containsPoint:aPoint
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3978
    "returns true if point is contained by the view
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3979
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3980
    ^ self containsPointX:(aPoint x) y:(aPoint y)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3981
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3982
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3983
containsPointX:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3984
    "returns true if point is contained by the view
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3985
    "
708
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3986
    ^ (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
  3987
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3988
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3989
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3990
hasGroupDividerAt:anIndex
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3991
    "returns true if a divider is defined at an index
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3992
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3993
    |i|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3994
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3995
    groupSizes size ~~ 0 ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3996
        i := 0.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3997
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3998
        groupSizes do:[:t|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3999
            (i := i + t) == anIndex ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4000
                ^ true
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4001
            ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4002
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4003
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4004
  ^ false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4005
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4006
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4007
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4008
hasGroupDividers
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4009
    "returns true if any group divider exists
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4010
    "
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4011
  ^ (items size ~~ 0 and:[groupSizes size ~~ 0])
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4012
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4013
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4014
isEnabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4015
    "returns enabled state of menu and items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4016
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4017
    ^ self enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4018
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4019
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4020
isFitPanel
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4021
    "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
  4022
     be fit to the extent of its superView;
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4023
     NOT SUPPORTED
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4024
    "
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4025
    ^ false
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4026
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4027
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4028
isPopUpView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4029
    "return true if view is a popup view; without decoration
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4030
     and popUp to top immediately
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4031
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4032
    ^ superView isNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4033
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4034
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4035
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4036
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4037
isVerticalLayout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4038
    "returns true if vertical layout otherwise false( horizontal layout )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4039
    "
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4040
    ^ self verticalLayout
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4041
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4042
416
c05874084d4c implement
ca
parents: 407
diff changeset
  4043
!
c05874084d4c implement
ca
parents: 407
diff changeset
  4044
1793
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  4045
isViewWrapper
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  4046
    ^ subViews size ~~ 0
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  4047
!
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  4048
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4049
openMenuOnSelect
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4050
    ^ (self menuAdornmentAt:#openMenuOnSelect) ? DefaultOpenOnSelect.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4051
        
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4052
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4053
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4054
openMenuOnSelect:something
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4055
    ^ self menuAdornmentAt:#openMenuOnSelect put:something
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4056
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4057
416
c05874084d4c implement
ca
parents: 407
diff changeset
  4058
type
428
ca
parents: 427
diff changeset
  4059
    ^ nil.
416
c05874084d4c implement
ca
parents: 407
diff changeset
  4060
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4061
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4062
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4063
!MenuPanel methodsFor:'selection'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4064
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4065
hasSelection
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4066
    "returns true if a selection exists
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4067
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4068
    ^ self selection notNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4069
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4070
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4071
selection
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4072
    "returns current selected item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4073
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4074
    ^ selection
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4075
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4076
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4077
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4078
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4079
selection:anItemOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4080
    "change selection to an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4081
    "
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  4082
    |item newSel hlp|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4083
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4084
    (newSel := anItemOrNil) isNumber ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4085
        newSel := self itemAt:anItemOrNil
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4086
    ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4087
    (newSel notNil and:[newSel canSelect]) ifFalse:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4088
        newSel := nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4089
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4090
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4091
    selection == newSel ifTrue:[^ self].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4092
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4093
    (item := selection) notNil ifTrue:[
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4094
        selection := nil.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4095
        item selected:false.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4096
    ].
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  4097
    newSel notNil ifTrue:[
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4098
        newSel == enteredItem ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4099
            enteredItem := nil
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4100
        ] ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4101
            self pointerEntersItem:nil
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4102
        ].
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4103
        selection := newSel.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4104
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4105
        ActiveHelp isActive ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4106
            hlp := ActiveHelp currentHelpListener.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4107
            hlp initiateHelpFor:self atX:nil y:nil now:true.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4108
        ].
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  4109
        realized ifTrue:[self rearrangeItems].
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4110
        selection selected:true.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4111
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4112
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4113
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4114
selectionIndex
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4115
    "returns index of current selection or 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4116
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4117
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4118
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4119
    (item := self selection) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4120
	^ self findFirst:[:el| el == item ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4121
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4122
    ^ 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4123
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4124
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4125
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4126
selectionIndex:anIndex
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4127
    "set selection at an index
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4128
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4129
    self selection:(self itemAt:anIndex)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4130
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4131
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4132
!MenuPanel methodsFor:'translation'!
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4133
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4134
translateGrabPoint:aGrabPoint
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4135
    "translate the grab point into self
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4136
    "
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4137
    superMenu isNil ifTrue:[
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4138
        "I am the grapView"
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4139
        aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4140
      ^ aGrabPoint
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4141
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4142
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4143
    relativeGrabOrigin isNil ifTrue:[
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4144
        relativeGrabOrigin := self topMenu translatePoint:0 to:self.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4145
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4146
    ^ relativeGrabOrigin + aGrabPoint
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4147
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4148
!
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4149
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4150
translateMenuPoint:aPoint toMenu:aMenu
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4151
    "translate a point into another menu its point
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4152
    "
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4153
    |grapPoint|
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4154
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4155
    aMenu == self ifTrue:[
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4156
        ^ aPoint
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4157
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4158
    grapPoint := aPoint - (self translateGrabPoint:0).
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4159
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4160
  ^ aMenu translateGrabPoint:grapPoint
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4161
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4162
!
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4163
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4164
translatePoint:aPoint to:aWindow2
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4165
    "translate a point in my window to the point in aWindow2( or root window if nil)
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4166
    "
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4167
    |vw
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4168
     bw "{ Class: SmallInteger }"
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4169
     sX "{ Class: SmallInteger }"
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4170
     sY "{ Class: SmallInteger }"
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4171
    |
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4172
    aPoint isNumber ifTrue:[
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4173
        sX := sY := aPoint.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4174
    ] ifFalse:[
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4175
        sX := aPoint x.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4176
        sY := aPoint y.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4177
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4178
    vw := self.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4179
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4180
    [vw notNil] whileTrue:[
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4181
        (vw == aWindow2) ifTrue:[
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4182
            ^ sX @ sY
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4183
        ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4184
        bw := vw borderWidth.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4185
        sX := sX + (vw left) - bw.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4186
        sY := sY + (vw  top) - bw.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4187
        vw := vw superView.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4188
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4189
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4190
    vw := aWindow2.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4191
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4192
    [vw notNil] whileTrue:[
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4193
        bw := vw borderWidth.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4194
        sX := sX - (vw left) + bw.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4195
        sY := sY - (vw  top) + bw.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4196
        vw := vw superView.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4197
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4198
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4199
    ^ sX @ sY
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4200
! !
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4201
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4202
!MenuPanel::Item class methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4203
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  4204
horizontalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  4205
    ^ HorizontalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  4206
!
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  4207
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4208
labelRightOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4209
    ^ LabelRightOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4210
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4211
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  4212
verticalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  4213
    ^ VerticalInset
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4214
!
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4215
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4216
verticalPopUpInset
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4217
    ^ VerticalPopUpInset
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4218
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4219
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4220
!MenuPanel::Item class methodsFor:'defaults'!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4221
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4222
separatorSize
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4223
    "returns size of a separator
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4224
    "
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4225
    ^ 10
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4226
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4227
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4228
updateStyleCache
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4229
    "setup defaults
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4230
     self updateStyleCache
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4231
    "
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4232
    <resource: #style (#'menuPanel.verticalInset')>
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4233
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4234
    HorizontalInset       := 2.
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4235
    VerticalInset         := MenuPanel styleSheet at:#'menuPanel.verticalInset' default:2.
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4236
    VerticalPopUpInset    := 2.
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4237
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4238
    HorizontalButtonInset := 3.
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4239
    VerticalButtonInset   := 3.
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4240
681
62c7cdaca188 extra default inset values for button behaviour added
tz
parents: 680
diff changeset
  4241
    LabelRightOffset      := 15.
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4242
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4243
1124
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4244
! !
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4245
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4246
!MenuPanel::Item class methodsFor:'instance creation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4247
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4248
in:aSuperMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4249
    ^ self in:aSuperMenu label:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4250
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4251
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4252
in:aSuperMenu label:aLabel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4253
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4254
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4255
    item := self new in:aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4256
    item label:aLabel.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4257
  ^ item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4258
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4259
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4260
in:aSuperMenu menuItem:aMenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4261
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4262
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4263
    item := self in:aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4264
    item menuItem:aMenuItem.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4265
  ^ item.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4266
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4267
1808
e8628b502a49 methodCategory change
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
  4268
!MenuPanel::Item methodsFor:'accepting'!
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4269
420
ca
parents: 417
diff changeset
  4270
canAccept
ca
parents: 417
diff changeset
  4271
    "returns true if item is acceptable
ca
parents: 417
diff changeset
  4272
    "
ca
parents: 417
diff changeset
  4273
  ^ (self enabled and:[self hasSubmenu not])
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4274
!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4275
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4276
toggleIndication
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4277
    "toggle indication or choice
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4278
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4279
    |arg|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4280
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4281
    indication notNil ifTrue:[    
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4282
        arg := self indicationValue not.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4283
        self indicationValue:arg.
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4284
    ] ifFalse:[
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4285
        choice notNil ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4286
            choice value:choiceValue.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4287
          ^ true
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4288
        ]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4289
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4290
    ^ arg
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4291
! !
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4292
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4293
!MenuPanel::Item methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4294
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4295
accessCharacter
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4296
    "returns my accessCharacter or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4297
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4298
    ^ accessCharacter
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4299
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4300
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4301
accessCharacterPosition
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4302
    "get the access character position or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4303
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4304
    ^ accessCharacterPosition
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4305
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4306
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4307
accessCharacterPosition:anIndex 
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4308
    "set the access character position or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4309
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4310
    accessCharacterPosition := anIndex.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4311
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4312
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4313
argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4314
    "gets the argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4315
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4316
    ^ argument
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4317
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4318
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4319
argument:anArgument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4320
    "sets the argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4321
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4322
    argument := anArgument.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4323
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4324
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4325
font
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4326
    "returns the user configured font or nil (default menu font)
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4327
    "
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4328
    ^ font
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4329
!
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4330
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4331
font:aFont
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4332
    "returns the user configured font or nil (default menu font)
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4333
    "
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4334
    aFont ~= font ifTrue:[
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4335
        font := aFont notNil ifTrue:[aFont onDevice:(menuPanel device)]
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4336
                            ifFalse:[nil].
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4337
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4338
        rawLabel notNil ifTrue:[
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4339
            "have to recompute the extent"
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4340
            self label:label
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4341
        ]
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4342
    ].
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4343
!
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4344
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4345
label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4346
    "returns the label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4347
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4348
    ^ label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4349
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4350
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4351
label:aLabel
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  4352
    "set a new label; if the label changed, a redraw is performed;
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  4353
     handle characters $& (ST-80 compatibility)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4354
    "
1797
28327a68241b give a few more pixels at the right if the used font is
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
  4355
    |size char lbl mfont f
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4356
     h "{ Class:SmallInteger }"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4357
     w "{ Class:SmallInteger }"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4358
    |
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4359
    accessCharacter := rawLabelExtent := disabledRawLabel := nil.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4360
    label    := aLabel value.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4361
    rawLabel := label value ? ''.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4362
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4363
    rawLabel isString ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4364
        "CHECK FOR SEPARATOR"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4365
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4366
        (isButton not and:[indication isNil and:[choice isNil]]) ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4367
            size := rawLabel size.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4368
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4369
            size == 0 ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4370
                rawLabel := nil.                        "blank separator"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4371
              ^ self
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4372
            ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4373
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4374
            size == 1 ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4375
                char := rawLabel first.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4376
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4377
                (char == $- or:[char == $=]) ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4378
                    label    := rawLabel.               "line separator"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4379
                    rawLabel := nil.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4380
                  ^ self
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4381
                ]
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4382
            ]
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4383
        ]
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4384
    ] ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4385
        rawLabel isCollection ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4386
            rawLabel := rawLabel asArray.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4387
        ]
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4388
    ].
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4389
    mfont := menuPanel setFont:font.
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4390
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4391
    rawLabel isArray ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4392
        w := h := 0.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4393
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4394
        rawLabel keysAndValuesDo:[:i :el|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4395
            el notNil ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4396
                lbl := self updateAccessCharacterFor:el.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4397
                rawLabel at:i put:lbl.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4398
                w := w max:(lbl widthOn:menuPanel).
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4399
                h := h + 1 + (lbl heightOn:menuPanel).
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4400
            ] ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4401
                h := h + 3
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4402
            ]
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4403
        ]
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4404
    ] ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4405
        rawLabel := self updateAccessCharacterFor:rawLabel.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4406
        w := rawLabel  widthOn:menuPanel.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4407
        h := rawLabel heightOn:menuPanel.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4408
    ].
1797
28327a68241b give a few more pixels at the right if the used font is
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
  4409
28327a68241b give a few more pixels at the right if the used font is
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
  4410
    "/ 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
  4411
    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
  4412
    (f notNil and:[f italic]) ifTrue:[
28327a68241b give a few more pixels at the right if the used font is
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
  4413
        w := w + 2.
28327a68241b give a few more pixels at the right if the used font is
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
  4414
    ].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4415
    rawLabelExtent := w@h.
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  4416
    menuPanel setFont:mfont.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4417
    menuPanel shown ifTrue:[ self fetchImages ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4418
    menuPanel mustRearrange
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4419
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4420
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4421
menuPanel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4422
    "returns my menuPanel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4423
    "
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  4424
    ^ menuPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4425
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4426
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4427
nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4428
    "gets the nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4429
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4430
    ^ nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4431
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4432
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4433
nameKey:aNameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4434
    "sets the nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4435
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4436
    nameKey := aNameKey.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4437
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4438
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4439
rawLabel
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4440
    "returns my printable Label
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4441
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4442
    ^ rawLabel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4443
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4444
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4445
shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4446
    "get the key to press to select the submenu from the keyboard or if
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4447
     no submenu exists evaluate the action assigned to the item (accept).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4448
    "
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  4449
    ^ shortcutKey
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4450
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4451
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4452
shortcutKey:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4453
    "set the key to press to select the submenu from the keyboard or if
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4454
     no submenu exists evaluate the action assigned to the item (accept).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4455
    "
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  4456
    shortcutKey ~~ aKey ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  4457
        shortcutKey := aKey.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4458
        self invalidate.
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4459
    ].
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4460
!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4461
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  4462
startGroup
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  4463
    "start group #left #right #center ... or nil
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  4464
     at the moment only #right is implemented
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  4465
    "
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  4466
    ^ startGroup
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  4467
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  4468
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  4469
startGroup:aSymbol
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  4470
    "start group #left #right #center ...
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  4471
     at the moment only #right is implemented
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  4472
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4473
    startGroup := aSymbol.
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  4474
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  4475
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4476
submenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4477
    "returns my submenu or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4478
    "
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4479
    subMenu notNil ifTrue:[^ subMenu].
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4480
  ^ self setupSubmenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4481
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4482
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4483
submenu:aSubMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4484
    "set a new submenu; an existing submenu will be destroyed. This might lead
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4485
     to a redraw if 'hasSubmenu' changed
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4486
    "
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4487
    |widget|
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4488
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4489
    aSubMenu isNil ifTrue:[
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4490
        subMenu notNil ifTrue:[
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4491
            subMenu destroy.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4492
            subMenu := nil.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4493
        ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4494
        ^ self
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4495
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4496
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4497
    (aSubMenu isKindOf:Menu) ifTrue:[
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4498
        subMenu := MenuPanel new.
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4499
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4500
        menuPanel notNil ifTrue:[
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4501
            subMenu receiver:menuPanel receiver.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4502
        ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4503
        subMenu superMenu:menuPanel.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4504
        subMenu menu:aSubMenu.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4505
    ] ifFalse:[
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4506
        aSubMenu isView ifFalse:[
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4507
            (aSubMenu isKindOf:ApplicationModel) ifFalse:[
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4508
                "/ ... mhhhh ....
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4509
                ^ self submenuChannel:aSubMenu
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4510
            ].            
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4511
            widget := SimpleView new.
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4512
            widget client:aSubMenu.
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4513
        ] ifTrue:[
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4514
            widget := aSubMenu
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4515
        ].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4516
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4517
        (widget isKindOf:MenuPanel) ifTrue:[
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4518
            subMenu := widget
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4519
        ] ifFalse:[
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4520
            subMenu := MenuPanel new.
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4521
            subMenu receiver:menuPanel receiver.
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4522
            subMenu addSubView:widget.
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4523
            subMenu extent:(widget preferredExtent).
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4524
            widget origin:0.0@0.0 corner:1.0@1.0.
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4525
        ].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4526
        subMenu superMenu:menuPanel.
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4527
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4528
        self keepLinkedMenu ifTrue:[
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  4529
            submenuChannel := nil
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  4530
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4531
    ].
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4532
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4533
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4534
textLabel
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4535
    "returns my textLabel or nil if none text
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4536
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4537
    |txt|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4538
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4539
    rawLabel notNil ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4540
        rawLabel isArray ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4541
            ^ rawLabel perform:#string ifNotUnderstood:nil
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4542
        ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4543
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4544
        rawLabel do:[:el|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4545
            (txt := el perform:#string ifNotUnderstood:nil) notNil ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4546
                ^ txt
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4547
            ]
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4548
        ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4549
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4550
    ^ nil
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4551
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4552
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4553
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4554
triggerOnDown
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4555
    "trigger the action if pressed
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4556
    "
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4557
    triggerOnDown == true ifTrue:[
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4558
        self hasSubmenu ifFalse:[^ true].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4559
        triggerOnDown := false.
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4560
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4561
    ^ false
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4562
!
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4563
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4564
triggerOnDown:aBool
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4565
    "trigger the action if pressed
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4566
    "
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4567
    triggerOnDown := aBool.
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4568
!
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4569
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4570
value
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4571
    "gets value
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4572
    "
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4573
    ^ value
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4574
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4575
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4576
value:something
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4577
    "could be a value holder, an action or selector
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4578
    "
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4579
    value := something.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  4580
!
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  4581
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  4582
value:aValue argument:anArgument
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  4583
    "set the value and an argument
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  4584
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4585
    value    := aValue.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4586
    argument := anArgument.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4587
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4588
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  4589
!MenuPanel::Item methodsFor:'accessing-behavior'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4590
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4591
choice
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4592
    "implements a radio group; the field
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4593
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4594
    ^ choice
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4595
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4596
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4597
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4598
choice:something
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4599
    "set choice indication
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4600
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4601
    choice == something ifTrue:[^ self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4602
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4603
    choice isValueModel ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4604
        choice removeDependent:self
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4605
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4606
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4607
    (choice := something) notNil ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4608
        choice isSymbol ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4609
            (choice := self aspectAt:choice) isNil ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4610
                choice := something
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4611
            ]
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4612
        ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4613
        choice isValueModel ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4614
            choice addDependent:self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4615
        ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4616
    ].
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4617
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4618
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4619
choiceValue
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4620
    "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
  4621
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4622
    ^ choiceValue
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4623
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4624
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4625
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4626
choiceValue:something
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4627
    "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
  4628
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4629
    choiceValue ~= something ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4630
        choiceValue := something.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4631
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4632
        choice notNil ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4633
            self invalidate
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4634
        ]
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4635
    ].
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4636
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4637
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4638
enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4639
    "returns the enabled state
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4640
    "
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4641
    |state|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4642
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4643
    menuPanel enabled ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4644
        enableChannel isSymbol ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4645
            state := self aspectAt:enableChannel.
1806
5ca7e602ca7c ignore Backspace in shortKey processing;
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  4646
            state isNil ifTrue:[
1902
8676e04e404a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
  4647
                ('MenuPanel::Item [info]: no aspect for ',enableChannel, ' (in ' , (label?rawLabel) printString , ')') infoPrintCR
1806
5ca7e602ca7c ignore Backspace in shortKey processing;
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  4648
            ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4649
            state isValueModel ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4650
                enableChannel := state.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4651
                enableChannel addDependent:self.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4652
                state := enableChannel value.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4653
            ] ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4654
                state := state value
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4655
            ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4656
        ] ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4657
            state := enableChannel value
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4658
        ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4659
      ^ state ~~ false
460
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  4660
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4661
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4662
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4663
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4664
enabled:something
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4665
    "change the enabled state; if the state changed, a redraw is performed
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4666
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4667
    |oldState newState|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4668
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4669
    enableChannel isNil ifTrue:[
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4670
        oldState := true
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4671
    ] ifFalse:[
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4672
        oldState := enableChannel value.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4673
        enableChannel isValueModel ifTrue:[
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4674
            enableChannel removeDependent:self
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4675
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4676
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4677
    enableChannel := something.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4678
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4679
    enableChannel isNil ifTrue:[
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4680
        menuPanel shown ifFalse:[^ self].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4681
        newState := true
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4682
    ] ifFalse:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4683
        enableChannel isValueModel ifTrue:[
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4684
            enableChannel addDependent:self
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4685
        ] ifFalse:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4686
            enableChannel isSymbol ifTrue:[^ self]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4687
        ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4688
        menuPanel shown ifFalse:[^ self].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4689
        newState := enableChannel value.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4690
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4691
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4692
    newState ~~ oldState ifTrue:[
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4693
        self invalidate
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4694
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4695
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4696
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  4697
hideMenuOnActivated
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  4698
    "hide the menu when the item was activated; the default is true
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  4699
    "
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  4700
    ^ hideMenuOnActivated ? true
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  4701
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  4702
!
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  4703
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  4704
hideMenuOnActivated:aBool
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  4705
   "hide the menu when the item was activated; the default is true
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  4706
   "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4707
   hideMenuOnActivated := aBool.
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  4708
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  4709
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  4710
!
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  4711
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4712
indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4713
    "get on/off indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4714
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4715
    ^ indication
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4716
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4717
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4718
indication:something
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4719
    "set on/off indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4720
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4721
    indication == something ifTrue:[^ self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4722
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4723
    indication isValueModel ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4724
        indication removeDependent:self
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4725
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4727
    (indication := something) notNil ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4728
        indication isValueModel ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4729
            indication addDependent:self
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4730
        ] ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4731
            "/ to force an update of the value
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4732
            self indicationValue
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4733
        ]
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4734
    ].
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4735
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4736
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4737
isButton
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4738
    "returns whether item looks like a Button
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4739
    "
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4740
    ^ isButton
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4741
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4742
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4743
isButton:anBoolean
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4744
    "sets whether item looks like a Button
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4745
    "
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4746
    isButton := anBoolean.
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4747
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4748
    layout notNil ifTrue:[
1731
89932327a6f8 redrawAsButton no longer exists; call invalidate
ca
parents: 1730
diff changeset
  4749
        self invalidate.
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4750
    ]
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4751
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4752
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4753
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4754
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4755
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4756
keepLinkedMenu
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4757
    "get the keepLinkedMenu flag
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4758
    "
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4759
    ^ keepLinkedMenu ? false
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4760
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4761
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4762
keepLinkedMenu:aFlag
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4763
    "get the keepLinkedMenu flag
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4764
    "
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4765
    keepLinkedMenu := aFlag
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4766
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4767
1697
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  4768
showBusyCursorWhilePerforming
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  4769
    "get the flag which controls if a busy cursor is to be shown
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4770
     while performing the menu action. Defaults to false.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4771
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4772
    ^ showBusyCursorWhilePerforming ? false
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4773
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4774
1697
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  4775
!
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  4776
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  4777
showBusyCursorWhilePerforming:aBoolean
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  4778
    "set/clear the flag which controls if a busy cursor is to be shown
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4779
     while performing the menu action. Defaults to false.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4780
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4781
    showBusyCursorWhilePerforming := aBoolean.
1697
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  4782
!
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  4783
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4784
submenuChannel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4785
    "get the submenu channel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4786
    "
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4787
  ^ submenuChannel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4788
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4789
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4790
submenuChannel:aSelectorOrNil
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4791
    "returns the submenu channel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4792
    "
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4793
    submenuChannel := aSelectorOrNil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4794
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4795
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  4796
!MenuPanel::Item methodsFor:'accessing-dimension'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4797
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4798
layout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4799
    "returns my layout ( Rectangle )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4800
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4801
    ^ layout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4802
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4803
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4804
layout:aLayout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4805
    "set a new layout ( Rectangle )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4806
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4807
    layout := aLayout.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4808
    self invalidate.
1692
200a0b2e23c1 call invalidate instead of redraw
ca
parents: 1691
diff changeset
  4809
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4810
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4811
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4812
preferredExtent
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4813
    "compute my preferred extent excluding the shortCutKey and the menu identifier
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4814
    "
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4815
    |isVertical
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4816
     x "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4817
     y "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4818
     s "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4819
    |
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4820
    self isVisible ifFalse:[^ 0@0 ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4821
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4822
    isButton ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4823
        s := menuPanel maxAbsoluteButtonLevel.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4824
        x := s + HorizontalButtonInset.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4825
        y := s + VerticalButtonInset.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4826
    ] ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4827
        x  := HorizontalInset.
1766
e3667c5b8b30 may not assign potential nil to a smallInt-typed variable
Claus Gittinger <cg@exept.de>
parents: 1765
diff changeset
  4828
        y  := (menuPanel isPopUpView ifTrue:[VerticalPopUpInset] ifFalse:[VerticalInset]) ? 2.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4829
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4830
    x := x * 2.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4831
    y := y * 2.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4832
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  4833
    isVertical := menuPanel verticalLayout.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  4834
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4835
    rawLabel isNil ifTrue:[
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  4836
        "SEPARATOR"
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4837
        s := self class separatorSize.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4838
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  4839
        "width of doubleSeparator is 5 !!!!"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  4840
        isVertical ifFalse:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4841
            x := x max:s.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4842
            y := y + 5.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4843
        ] ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4844
            y := y max:s.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4845
            x := x + 5.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4846
        ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4847
    ] ifFalse:[
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4848
        x := x + rawLabelExtent x.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4849
        y := y + rawLabelExtent y.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4850
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4851
        isButton ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4852
            menuPanel showSeparatingLines ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4853
                "width of separator is 2 plus right offset 1 := 3"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4854
                isVertical ifFalse:[x := x + 3] ifTrue:[y := y + 3].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4855
            ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4856
            (indication notNil or:[choice notNil]) ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4857
                x := x + 2 + menuPanel iconIndicationOff width.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4858
            ].
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  4859
        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4860
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4861
    ^ x@y
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4862
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4863
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  4864
!MenuPanel::Item methodsFor:'accessing-help'!
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4865
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4866
activeHelpKey
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4867
    "get the active helpKey; the key to retrieve the helpText from the application
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4868
    "
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4869
    ^ activeHelpKey
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4870
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4871
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4872
activeHelpKey:aHelpKey
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4873
    "set the active helpKey; the key to retrieve the helpText from the application
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4874
    "
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4875
    activeHelpKey ~~ aHelpKey ifTrue:[
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4876
        activeHelpKey  := aHelpKey.
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4877
        activeHelpText := nil.
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4878
    ].
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4879
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4880
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4881
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4882
activeHelpText
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4883
    "get the active helpText or nil if not yet resolved
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4884
    "
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4885
    ^ activeHelpText
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4886
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4887
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4888
activeHelpText:aText
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4889
    "set the active helpText
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4890
    "
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4891
    activeHelpText := aText.
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4892
! !
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4893
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4894
!MenuPanel::Item methodsFor:'activation / deactivation'!
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4895
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4896
currentSubmenu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4897
    "returns the current submenu or nil
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4898
    "
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4899
    ^ subMenu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4900
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4901
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4902
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4903
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4904
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4905
hideSubmenu
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4906
    "hide submenu
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4907
    "
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4908
    |id|
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4909
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4910
    subMenu notNil ifTrue:[
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4911
        subMenu realized ifFalse:[
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4912
            (id := subMenu id) notNil ifTrue:[
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4913
                menuPanel device unmapWindow:id
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4914
            ]
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4915
        ] ifTrue:[
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4916
           subMenu hide
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4917
        ].
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4918
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4919
        subMenu windowGroup:nil.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4920
        menuPanel windowGroup removeView:subMenu.
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4921
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4922
        "/ release menu if derived from channel
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4923
        submenuChannel notNil ifTrue:[
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4924
            subMenu := nil
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4925
        ]
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4926
     ].
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4927
!
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4928
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4929
openSubmenu
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4930
    "opens the submenu; make sure, that the submenu and the menPanel
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4931
     is fully visible by shifting it into the visible screen area if
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4932
     nescessary.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4933
    "
1790
98b89f8f4c17 do not select the first item if it represants a submenu
ca
parents: 1788
diff changeset
  4934
    |p o device isVertical topMenu windGrp prefExtent item
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4935
     devBot   "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4936
     devRight "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4937
     width    "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4938
     height   "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4939
     top      "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4940
     left     "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4941
    |
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4942
1737
c18896a7cb50 replace shown by realized; when opening a submenue-submenue by shortcut key
ca
parents: 1735
diff changeset
  4943
    (subMenu notNil and:[subMenu shown not and:[self isSelected and:[menuPanel realized]]]) ifFalse:[
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4944
        ^ self
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4945
    ].
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4946
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4947
    topMenu := menuPanel topMenu.
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  4948
    (subMenu device notNil and:[topMenu device ~~ subMenu device]) ifTrue:[
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  4949
        subMenu releaseDeviceResources.
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  4950
        subMenu setDevice:topMenu device id:nil gcId:nil.
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  4951
        subMenu recreate.
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  4952
    ].
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  4953
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4954
    windGrp := topMenu windowGroup.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4955
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  4956
    subMenu superMenu:menuPanel.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4957
    subMenu becomesActiveMenu.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4958
    subMenu cursor:Cursor hand.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4959
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4960
    windGrp notNil ifTrue:[
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4961
        subMenu windowGroup:windGrp.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4962
        windGrp addTopView:subMenu.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4963
    ].
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4964
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4965
    " Q&D kludge - if any visibility attributes are blocks;
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4966
      TODO: only invoke mustRearrange if any are blocks
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4967
            (since I react correctly on valueHolder changes)
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4968
    "
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4969
    subMenu rearrangeItemsIfItemVisibilityChanged.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4970
    subMenu fixSize.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4971
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4972
    "compute origin of subMenu
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4973
    "
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4974
    isVertical := menuPanel verticalLayout.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4975
    device     := menuPanel device.
1714
b4c05977e9d5 get heigth and width from preferredExtent when open a submenu
ca
parents: 1710
diff changeset
  4976
    prefExtent := subMenu preferredExtent.
b4c05977e9d5 get heigth and width from preferredExtent when open a submenu
ca
parents: 1710
diff changeset
  4977
    height     := prefExtent y.
b4c05977e9d5 get heigth and width from preferredExtent when open a submenu
ca
parents: 1710
diff changeset
  4978
    width      := prefExtent x.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4979
    devBot     := device  usableHeight.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4980
    devRight   := device  usableWidth.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4981
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4982
    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
  4983
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  4984
    menuPanel isPopUpView ifTrue:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  4985
        o := menuPanel origin + p
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  4986
    ] ifFalse:[
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4987
        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
  4988
    ].
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4989
    left := o x.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4990
    top  := o y.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4991
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4992
    left + width > devRight ifTrue:[
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4993
        left := isVertical ifTrue:[left - layout width - width]
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4994
                          ifFalse:[devRight - width]
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4995
    ].
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4996
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4997
    top + height > devBot ifTrue:[
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4998
        top := isVertical ifTrue:[devBot - height]
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  4999
                         ifFalse:[top - layout height - height]
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5000
    ].
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5001
    top  := top  max:0.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5002
    left := left max:0.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5003
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5004
    subMenu origin:(left@top).
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5005
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5006
    subMenu realized ifFalse:[
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5007
        subMenu realize. 
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5008
    ] ifTrue:[
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5009
        topMenu device mapWindow:(subMenu id).
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5010
    ].
1790
98b89f8f4c17 do not select the first item if it represants a submenu
ca
parents: 1788
diff changeset
  5011
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5012
    menuPanel openMenuOnSelect ifFalse:[
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5013
        (    menuPanel superMenu notNil                                         "/ not the top menu
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5014
         or:[((item := subMenu itemAt:1) notNil and:[item hasSubmenu not])]     "/ top menu but no submenu item
1790
98b89f8f4c17 do not select the first item if it represants a submenu
ca
parents: 1788
diff changeset
  5015
        ) ifTrue:[
98b89f8f4c17 do not select the first item if it represants a submenu
ca
parents: 1788
diff changeset
  5016
            subMenu selectionIndex:1
98b89f8f4c17 do not select the first item if it represants a submenu
ca
parents: 1788
diff changeset
  5017
        ]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5018
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5019
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5020
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5021
toggleSubmenuVisibility
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5022
    "toggle the visibility of the submenu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5023
    "
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5024
    subMenu notNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5025
        subMenu shown ifTrue:[^ self hideSubmenu]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5026
    ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5027
        (subMenu := self setupSubmenu) isNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5028
            "/ cannot open a submenu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5029
            ^ self
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5030
        ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5031
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5032
    self openSubmenu.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5033
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5034
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5035
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5036
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5037
visibleSubmenu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5038
    "returns the current visible submenu or nil
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5039
    "
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5040
    subMenu notNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5041
        subMenu shown ifTrue:[^ subMenu].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5042
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5043
    ^ nil
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5044
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5045
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5046
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5047
! !
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5048
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5049
!MenuPanel::Item methodsFor:'building'!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5050
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5051
aspectAt:aKey
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5052
    "retursns value assigned to key or nil
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5053
    "
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5054
    |appl value|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5055
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5056
    appl := menuPanel receiver.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5057
1219
6a0d677a6fac removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents: 1218
diff changeset
  5058
    (appl isValueModel) ifTrue:[
1775
7b63410aa8b3 allow selector with argument for #enabled and #visible
ca
parents: 1767
diff changeset
  5059
        ^ appl value:aKey
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5060
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5061
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5062
    (appl notNil or:[(appl := menuPanel application) notNil]) ifTrue:[
1775
7b63410aa8b3 allow selector with argument for #enabled and #visible
ca
parents: 1767
diff changeset
  5063
        Object messageNotUnderstoodSignal handle:[:ex|
7b63410aa8b3 allow selector with argument for #enabled and #visible
ca
parents: 1767
diff changeset
  5064
            ex parameter selector == aKey ifFalse:[
7b63410aa8b3 allow selector with argument for #enabled and #visible
ca
parents: 1767
diff changeset
  5065
                ex reject
7b63410aa8b3 allow selector with argument for #enabled and #visible
ca
parents: 1767
diff changeset
  5066
            ].
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  5067
            ('MenuPanel [info]: application does not provide aspect ' , aKey) infoPrintCR.
1775
7b63410aa8b3 allow selector with argument for #enabled and #visible
ca
parents: 1767
diff changeset
  5068
        ] do:[
7b63410aa8b3 allow selector with argument for #enabled and #visible
ca
parents: 1767
diff changeset
  5069
            aKey last == $: ifTrue:[
7b63410aa8b3 allow selector with argument for #enabled and #visible
ca
parents: 1767
diff changeset
  5070
                value := appl perform:aKey with:(argument ? self).
7b63410aa8b3 allow selector with argument for #enabled and #visible
ca
parents: 1767
diff changeset
  5071
            ] ifFalse:[
7b63410aa8b3 allow selector with argument for #enabled and #visible
ca
parents: 1767
diff changeset
  5072
                (appl isKindOf:ApplicationModel) ifTrue:[
7b63410aa8b3 allow selector with argument for #enabled and #visible
ca
parents: 1767
diff changeset
  5073
                    value := appl aspectFor:aKey
7b63410aa8b3 allow selector with argument for #enabled and #visible
ca
parents: 1767
diff changeset
  5074
                ] ifFalse:[
7b63410aa8b3 allow selector with argument for #enabled and #visible
ca
parents: 1767
diff changeset
  5075
                    value := appl perform:aKey
7b63410aa8b3 allow selector with argument for #enabled and #visible
ca
parents: 1767
diff changeset
  5076
                ]
7b63410aa8b3 allow selector with argument for #enabled and #visible
ca
parents: 1767
diff changeset
  5077
            ]
7b63410aa8b3 allow selector with argument for #enabled and #visible
ca
parents: 1767
diff changeset
  5078
        ]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5079
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5080
    ^ value
1029
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  5081
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  5082
    "Modified: / 29.7.1998 / 11:59:50 / cg"
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5083
! !
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5084
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5085
!MenuPanel::Item methodsFor:'change & update'!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5086
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5087
update:something with:aParameter from:changedObject
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5088
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5089
    |form rect|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5090
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5091
    (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
  5092
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5093
    self isSeparator ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5094
        "/ NOT A SEPARATOR
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5095
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5096
        menuPanel shown ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5097
            changedObject == enableChannel ifTrue:[
1864
cbc44ec70112 clear selection if item changed to disabled durring selected
ca
parents: 1862
diff changeset
  5098
                (enableChannel value == false and:[self isSelected]) ifTrue:[
cbc44ec70112 clear selection if item changed to disabled durring selected
ca
parents: 1862
diff changeset
  5099
                    ^ menuPanel selection:nil.
cbc44ec70112 clear selection if item changed to disabled durring selected
ca
parents: 1862
diff changeset
  5100
                ].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5101
                ^ self invalidate
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5102
            ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5103
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5104
            (changedObject == indication or:[changedObject == choice]) ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5105
                isButton ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5106
                    self invalidate
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5107
                ] ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5108
                    "/ invalidate the interactor only
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5109
                    "/ take any interactor; interactors has the same extent
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5110
                    form := menuPanel iconIndicationOff.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5111
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5112
                    rect := Rectangle left:(layout left + HorizontalInset)
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5113
                                       top:(layout top)
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5114
                                     width:(form width)
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5115
                                    height:(layout height).
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5116
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5117
                    menuPanel invalidate:rect repairNow:false
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5118
                ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5119
                ^ self
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5120
            ].
1692
200a0b2e23c1 call invalidate instead of redraw
ca
parents: 1691
diff changeset
  5121
        ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  5122
    ].
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5123
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5124
    changedObject == isVisible ifTrue:[
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  5125
        menuPanel mustRearrange.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  5126
        menuPanel rearrangeItems.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  5127
      ^ self.
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5128
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5129
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  5130
    super update:something with:aParameter from:changedObject
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5131
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5132
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5133
updateIndicators
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5134
    "update indicators
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5135
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5136
    (indication notNil and:[indication isSymbol]) ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5137
        " indication is a selector otherwise a change notification
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  5138
          is raised from the model !!!!
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  5139
        "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5140
        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
  5141
    ]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5142
! !
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5143
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5144
!MenuPanel::Item methodsFor:'converting'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5145
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5146
asMenuItem
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5147
    "convert to a MenuItem
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5148
    "
466
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  5149
    |item label rcv|
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  5150
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  5151
    label := self label.
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  5152
    item  := MenuItem labeled:(label printString).
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  5153
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  5154
    label isImage ifTrue:[
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5155
        rcv := ResourceRetriever new.
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5156
        rcv className:#MenuEditor.
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5157
        rcv selector:#iconUnknown.
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5158
        item labelImage:rcv.
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5159
    ].
466
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  5160
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  5161
    item activeHelpKey:activeHelpKey.
460
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  5162
1819
576b0aaf9df1 asMenuItem: do not resolve models
ca
parents: 1811
diff changeset
  5163
    enableChannel isSymbol ifTrue:[
576b0aaf9df1 asMenuItem: do not resolve models
ca
parents: 1811
diff changeset
  5164
        item enabled:enableChannel
460
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  5165
    ].
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5166
    item font:font.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5167
    item accessCharacterPosition:accessCharacterPosition.
1819
576b0aaf9df1 asMenuItem: do not resolve models
ca
parents: 1811
diff changeset
  5168
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5169
    item startGroup:startGroup.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5170
    item argument:argument.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5171
    item nameKey:nameKey.
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5172
    item shortcutKeyCharacter:shortcutKey.
1819
576b0aaf9df1 asMenuItem: do not resolve models
ca
parents: 1811
diff changeset
  5173
    value      isSymbol ifTrue:[item value:value].
576b0aaf9df1 asMenuItem: do not resolve models
ca
parents: 1811
diff changeset
  5174
    indication isSymbol ifTrue:[item indication:indication].
576b0aaf9df1 asMenuItem: do not resolve models
ca
parents: 1811
diff changeset
  5175
    choice     isSymbol ifTrue:[item choice:choice].
576b0aaf9df1 asMenuItem: do not resolve models
ca
parents: 1811
diff changeset
  5176
    isVisible  isSymbol ifTrue:[item isVisible:isVisible].
576b0aaf9df1 asMenuItem: do not resolve models
ca
parents: 1811
diff changeset
  5177
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5178
    item choiceValue:choiceValue.
1819
576b0aaf9df1 asMenuItem: do not resolve models
ca
parents: 1811
diff changeset
  5179
    item hideMenuOnActivated:hideMenuOnActivated.
576b0aaf9df1 asMenuItem: do not resolve models
ca
parents: 1811
diff changeset
  5180
    item keepLinkedMenu:keepLinkedMenu.
576b0aaf9df1 asMenuItem: do not resolve models
ca
parents: 1811
diff changeset
  5181
    item showBusyCursorWhilePerforming:showBusyCursorWhilePerforming.
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5182
    item triggerOnDown:(self triggerOnDown).
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  5183
    item isButton:isButton.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5184
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5185
    submenuChannel isSymbol ifTrue:[
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5186
        item submenuChannel:submenuChannel
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5187
    ] ifFalse:[
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5188
        subMenu notNil ifTrue:[
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5189
            item submenu:(subMenu asMenu)
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5190
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5191
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5192
  ^ item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5193
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5194
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5195
menuItem:aMenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5196
    "setup attributes from a MenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5197
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5198
    |lbl|
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5199
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5200
    menuPanel disabledRedrawDo:[
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5201
        label := rawLabel := nil.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5202
        accessCharacterPosition       := aMenuItem accessCharacterPosition.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5203
        argument                      := aMenuItem argument.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5204
        choiceValue                   := aMenuItem choiceValue.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5205
        showBusyCursorWhilePerforming := aMenuItem showBusyCursorWhilePerforming.
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5206
        triggerOnDown                 := aMenuItem triggerOnDown.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5207
        hideMenuOnActivated           := aMenuItem hideMenuOnActivated.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5208
        keepLinkedMenu                := aMenuItem keepLinkedMenu.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5209
        isButton                      := aMenuItem isButton ? false.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5210
        nameKey                       := aMenuItem nameKey.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5211
        startGroup                    := aMenuItem startGroup.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5212
        shortcutKey                   := aMenuItem shortcutKeyCharacter.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5213
        value                         := aMenuItem value.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5214
        activeHelpKey                 := aMenuItem activeHelpKey.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5215
        activeHelpText                := nil.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5216
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5217
        self font:(aMenuItem font).
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5218
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5219
        self    enabled:(aMenuItem enabled).
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5220
        self indication:(aMenuItem indication).
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5221
        self     choice:(aMenuItem choice).
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5222
        self  isVisible:(aMenuItem isVisible).
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5223
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5224
        (lbl := aMenuItem labelImage value) isNil ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5225
            lbl := aMenuItem rawLabel. "/ avoid translating &'s twice
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5226
        ].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5227
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5228
        self label:lbl.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5229
        submenuChannel := aMenuItem submenuChannel.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5230
        self submenu:(aMenuItem submenu).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5231
    ]
1033
9badc22e3d03 oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents: 1032
diff changeset
  5232
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  5233
    "Modified: / 22.8.1998 / 15:34:16 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5234
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5235
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5236
!MenuPanel::Item methodsFor:'drawing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5237
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5238
drawButton
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5239
    "draw as button
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5240
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5241
    |drawObject fg level isSelected bg ownBgCol
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5242
     x "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5243
    |
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5244
    drawObject := rawLabel.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5245
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5246
    "COMPUTE COLORS"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5247
    (isSelected := self isSelected) ifTrue:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5248
        bg := self activeBackgroundColor.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5249
        fg := self activeForegroundColor.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5250
    ] ifFalse:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5251
        self isEntered ifTrue:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5252
            bg := self buttonEnteredBackgroundColor
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5253
        ] ifFalse:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5254
            bg := self backgroundColor
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5255
        ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5256
        self enabled ifTrue:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5257
            fg := menuPanel foregroundColor
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5258
        ] ifFalse:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5259
            fg := menuPanel disabledForegroundColor.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5260
            drawObject := self disabledRawLabel
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5261
        ]
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5262
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5263
1708
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  5264
    (ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  5265
        bg := ownBgCol
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  5266
    ].
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  5267
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5268
    "DRAW BACKGROUND"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5269
    bg ~= menuPanel backgroundColor ifTrue:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5270
        menuPanel paint:bg.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5271
        menuPanel fillRectangle:layout.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5272
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5273
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5274
    x := layout left + menuPanel buttonPassiveLevel + HorizontalButtonInset.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5275
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5276
    isSelected ifFalse:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5277
        "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
  5278
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5279
        indication notNil ifTrue:[
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5280
            "button is indicator and set"
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5281
            isSelected := self indicationValue
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5282
        ] ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5283
            isSelected := (choice notNil and:[choice value = choiceValue]).
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5284
        ]
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5285
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5286
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5287
    isSelected ifTrue:[   
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5288
        level := menuPanel buttonActiveLevel.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5289
        x     := x + level abs.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5290
    ] ifFalse:[   
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5291
        level := self isEntered ifTrue:[menuPanel buttonEnteredLevel]
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5292
                               ifFalse:[menuPanel buttonPassiveLevel].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5293
    ].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5294
    self drawRawLabel:drawObject atX:x paint:fg.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5295
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5296
    level ~~ 0 ifTrue:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5297
        menuPanel drawButtonEdgesFor:self level:level
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5298
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5299
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5300
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5301
drawLabel
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5302
    "draw a labeled entry; no button, no separator.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5303
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5304
    |scKey cLb cLa drawObject fg arrow 
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5305
     isSelected isEnabled form
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5306
     h "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5307
     y "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5308
     x "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5309
     t "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5310
    |
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5311
    drawObject := rawLabel.
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  5312
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5313
    isEnabled := self enabled.
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5314
    isSelected := self isSelected.
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5315
    isSelected ifTrue:[
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5316
        fg := self activeForegroundColor
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5317
    ] ifFalse:[
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5318
        isEnabled ifTrue:[
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5319
            fg := menuPanel foregroundColor
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5320
        ] ifFalse:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5321
            fg  := menuPanel disabledForegroundColor.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5322
            drawObject := self disabledRawLabel
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5323
        ]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5324
    ].
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5325
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5326
    h := layout height.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5327
    x := layout left + HorizontalInset.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5328
    t := layout top.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5329
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5330
    ((form := self indicatorForm) notNil or:[(form := self choiceForm) notNil]) ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5331
        y := t + ((h - form height) // 2).
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5332
        
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5333
        form displayOn:menuPanel x:x y:y.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5334
        x := x + 2 + form width.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5335
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5336
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5337
    self drawRawLabel:drawObject atX:x paint:fg.
1046
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  5338
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  5339
    "/ DRAW SHORTCUT KEY
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  5340
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5341
    (     shortcutKey notNil
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5342
     and:[(x := menuPanel shortKeyInset) ~~ 0
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5343
     and:[(scKey:= self shortcutKeyAsString) notNil]]
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5344
    ) ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5345
        x := layout left + x.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5346
        y := t + ((h - (scKey heightOn:menuPanel)) // 2).
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5347
        y := y + menuPanel font ascent.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5348
        scKey displayOn:menuPanel x:x y:y. 
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  5349
    ].
963
2660033bc16e hide shortKeys in menu (may be later enabled via a classVar)
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  5350
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  5351
    "/ DRAW SUBMENU INDICATION
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5352
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5353
    (menuPanel isVerticalLayout and:[self hasSubmenu]) ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5354
        arrow := menuPanel rightArrow.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5355
        x := layout right - arrow width - HorizontalInset.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5356
        y := t + (h - arrow height // 2).
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5357
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5358
        (menuPanel styleSheet is3D not
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5359
        or:[(drawObject := menuPanel rightArrowShadow) isNil]) ifTrue:[
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5360
            ^ menuPanel displayForm:arrow x:x y:y
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5361
        ].
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5362
        cLa := menuPanel shadowColor.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5363
        cLb := menuPanel lightColor.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5364
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5365
        isSelected ifFalse:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5366
            fg  := cLa.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5367
            cLa := cLb.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5368
            cLb := fg
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5369
        ].
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5370
        menuPanel paint:cLa.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5371
        menuPanel displayForm:arrow x:x y:y.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5372
        menuPanel paint:cLb.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5373
        menuPanel displayForm:drawObject x:x y:y. 
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5374
    ]
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  5375
1124
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  5376
    "Modified: / 6.9.1998 / 21:48:53 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5377
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5378
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5379
drawRawLabel:aLabel atX:x paint:fg
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5380
    "draw a labeled entry; no button, no separator.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5381
    "
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5382
    |mfont
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5383
     y  "{ Class:SmallInteger }"
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5384
     y0 "{ Class:SmallInteger }"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5385
     x0 "{ Class:SmallInteger }"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5386
    |
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5387
    mfont := menuPanel setFont:font.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5388
    menuPanel paint:fg.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5389
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5390
    y := layout top + (layout height - rawLabelExtent y // 2).
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5391
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5392
    aLabel isArray ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5393
        aLabel isImageOrForm ifFalse:[
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5394
            y := y + menuPanel font ascent.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5395
        ].
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5396
        aLabel displayOn:menuPanel x:x y:y.
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5397
    ] ifTrue:[
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5398
        aLabel do:[:el|
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5399
            el notNil ifTrue:[
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5400
                el isImageOrForm ifFalse:[
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5401
                    y0 := y + menuPanel font ascent
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5402
                ] ifTrue:[
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5403
                    y0 := y
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5404
                ].
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5405
                x0 := x + (rawLabelExtent x - (el widthOn:menuPanel) // 2).
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5406
                el displayOn:menuPanel x:x0 y:y0.
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5407
                y := y + 1 + (el heightOn:menuPanel)
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5408
            ] ifFalse:[
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5409
                y := y + 3   "/ see #label:
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5410
            ]
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5411
        ].
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5412
    ].
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5413
    menuPanel setFont:mfont
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5414
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5415
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5416
drawSeparatingLines
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5417
    "draw separating lines
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5418
    "
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5419
    |index item lfSep rtSep items
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5420
     l "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5421
     t "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5422
     r "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5423
     b "{ Class:SmallInteger }"
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  5424
    |
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5425
    items := menuPanel items.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5426
    index := items identityIndexOf:self.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5427
    item  := items at:(index - 1) ifAbsent:nil.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5428
    lfSep := item notNil and:[item isButton not].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5429
    item  := items at:(index + 1) ifAbsent:nil.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5430
    rtSep := item notNil and:[item isButton not].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5431
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5432
    (lfSep isNil and:[rtSep]) isNil ifTrue:[
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  5433
        ^ self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5434
    ].
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5435
    menuPanel paint:(menuPanel lightColor).
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5436
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  5437
    l := layout left.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  5438
    t := layout top.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  5439
    r := layout right.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  5440
    b := layout bottom.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5441
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5442
    menuPanel verticalLayout ifTrue:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5443
        lfSep ifTrue:[menuPanel displayLineFromX:l y:t-1 toX:r y:t-1].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5444
        rtSep ifTrue:[menuPanel displayLineFromX:l y:b-1 toX:r y:b-1].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5445
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5446
        menuPanel paint:(menuPanel shadowColor).
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5447
        lfSep ifTrue:[menuPanel displayLineFromX:l y:t-2 toX:r y:t-2].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5448
        rtSep ifTrue:[menuPanel displayLineFromX:l y:b-2 toX:r y:b-2].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5449
    ] ifFalse:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5450
        lfSep ifTrue:[menuPanel displayLineFromX:l-1 y:t toX:l-1 y:b].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5451
        rtSep ifTrue:[menuPanel displayLineFromX:r-1 y:t toX:r-1 y:b].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5452
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5453
        menuPanel paint:(menuPanel shadowColor).
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5454
        lfSep ifTrue:[menuPanel displayLineFromX:l-2 y:t toX:l-2 y:b].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5455
        rtSep ifTrue:[menuPanel displayLineFromX:r-2 y:t toX:r-2 y:b]. 
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5456
    ]
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5457
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5458
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5459
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5460
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5461
drawSeparator
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5462
    "draw as separator
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5463
    "
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5464
    |type lightColor isDouble
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5465
     x0  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5466
     x1  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5467
     y0  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5468
     y1  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5469
    |
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5470
    type := self separatorType.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5471
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5472
    (type isNil or:[type == #blankLine]) ifTrue:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5473
        ^ self
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5474
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5475
    isDouble   := type == #doubleLine.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5476
    lightColor := menuPanel lightColor.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5477
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5478
    menuPanel paint:(menuPanel shadowColor).
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5479
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5480
    menuPanel verticalLayout ifTrue:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5481
        x0 := layout left  + HorizontalInset.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5482
        x1 := layout right - HorizontalInset.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5483
        y0 := layout top   - 1 + (layout height // 2).
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5484
        isDouble ifTrue:[y0 := y0 - 2].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5485
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5486
                         menuPanel displayLineFromX:x0 y:y0   toX:x1 y:y0.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5487
        isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+4 toX:x1 y:y0+4].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5488
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5489
        menuPanel paint:lightColor.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5490
                         menuPanel displayLineFromX:x0 y:y0+1 toX:x1 y:y0+1.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5491
        isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+5 toX:x1 y:y0+5].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5492
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5493
    ] ifFalse:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5494
        y1 := layout bottom.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5495
        x0 := layout left - 1 + (layout width // 2).
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5496
        y0 := layout top.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5497
        isDouble ifTrue:[x0 := x0 - 2].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5498
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5499
                         menuPanel displayLineFromX:x0   y:y0 toX:x0   y:y1.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5500
        isDouble ifTrue:[menuPanel displayLineFromX:x0+4 y:y0 toX:x0+4 y:y1].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5501
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5502
        menuPanel paint:lightColor.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5503
                         menuPanel displayLineFromX:x0+1 y:y0 toX:x0+1 y:y1.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5504
        isDouble ifTrue:[menuPanel displayLineFromX:x0+5 y:y0 toX:x0+5 y:y1].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5505
    ]
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5506
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5507
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5508
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5509
invalidate
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5510
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5511
    (rawLabel notNil and:[menuPanel notNil]) ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5512
        menuPanel invalidateItem:self repairNow:false
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5513
    ]
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5514
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5515
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5516
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5517
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5518
redraw
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5519
    "redraw item
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5520
    "
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5521
    |isSelected ownBgCol paint bgColor
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5522
     x  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5523
     y  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5524
     w  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5525
     h  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5526
    |
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5527
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5528
    self isVisible ifFalse:[^ self].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5529
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5530
    rawLabel isNil  ifTrue:[^ self drawSeparator].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5531
    isButton        ifTrue:[^ self drawButton].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5532
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5533
    "/ DRAW A LABELED ENTRY; no button, no separator
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5534
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5535
    isSelected := self isSelected.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5536
    bgColor    := menuPanel backgroundColor.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5537
    paint      := isSelected ifTrue:[self activeBackgroundColor] ifFalse:[bgColor].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5538
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5539
    (ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5540
        paint := ownBgCol
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5541
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5542
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5543
    paint ~= bgColor ifTrue:[
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  5544
        menuPanel paint:paint.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  5545
        menuPanel fillRectangle:layout.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5546
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5547
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5548
    menuPanel showSeparatingLines ifTrue:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5549
        self drawSeparatingLines
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  5550
    ].
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  5551
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  5552
    self drawLabel.  
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  5553
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  5554
    (ownBgCol notNil and:[isSelected]) ifTrue:[
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  5555
        ownBgCol brightness > 0.5 ifTrue:[menuPanel paint: menuPanel selectionFrameDarkColor]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  5556
                                 ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  5557
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5558
        x := layout left.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5559
        y := layout top.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5560
        w := layout width.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5561
        h := layout height.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5562
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5563
        menuPanel displayRectangleX:(x + 1) y:(y + 1) width:(w - 2) height:(h - 2).
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5564
        menuPanel displayRectangleX:(x + 2) y:(y + 2) width:(w - 4) height:(h - 4).  
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  5565
    ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  5566
    menuPanel drawLabelEdgeFor:self selected:isSelected.
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  5567
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5568
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5569
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5570
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5571
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5572
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5573
!MenuPanel::Item methodsFor:'initialization'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5574
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5575
destroy
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  5576
    "destroy submenus, remove dependencies
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5577
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  5578
    self submenu:nil.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  5579
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5580
    enableChannel isValueModel ifTrue:[enableChannel removeDependent:self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5581
    isVisible     isValueModel  ifTrue:[isVisible    removeDependent:self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5582
    indication    isValueModel ifTrue:[indication    removeDependent:self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5583
    choice        isValueModel ifTrue:[choice        removeDependent:self].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  5584
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5585
    menuPanel := nil.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  5586
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  5587
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  5588
in:aPanel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  5589
    "create item in a menuPanel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  5590
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  5591
    menuPanel := aPanel.
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  5592
    isButton  := false.
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  5593
!
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  5594
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  5595
reinitStyle
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  5596
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  5597
    subMenu notNil ifTrue:[
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  5598
        subMenu reinitStyle
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  5599
    ].
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  5600
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  5601
    "Created: / 17.8.2000 / 17:57:07 / cg"
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  5602
    "Modified: / 17.8.2000 / 18:00:08 / cg"
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  5603
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  5604
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  5605
!MenuPanel::Item methodsFor:'label basics'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  5606
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  5607
disabledRawLabel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  5608
    "returns the label used if the item is disabled
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  5609
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5610
    |block form image|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5611
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5612
    disabledRawLabel notNil ifTrue:[^ disabledRawLabel].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5613
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5614
    disabledRawLabel := rawLabel ? ''.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5615
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5616
    disabledRawLabel isString ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5617
        ^ disabledRawLabel
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5618
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5619
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5620
    block := [:el| |rslt|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5621
        (rslt := el) notNil ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5622
            el isImageOrForm ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5623
                el colorMap notNil ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5624
                    rslt := menuPanel lightenedImageOnDevice:el
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5625
                ]
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5626
            ] ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5627
                el class == LabelAndIcon ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5628
                    ((form := el icon) notNil and:[form colorMap notNil]) ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5629
                        form := menuPanel lightenedImageOnDevice:form
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5630
                    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5631
                    ((image := el image) notNil and:[image colorMap notNil]) ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5632
                        image := menuPanel lightenedImageOnDevice:image
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5633
                    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5634
                    rslt := LabelAndIcon form:form image:image string:(el string).
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5635
                ]
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5636
            ]
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5637
        ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5638
        rslt
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5639
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5640
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5641
    rawLabel isArray ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5642
        disabledRawLabel := Array new:(rawLabel size).
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5643
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5644
        rawLabel keysAndValuesDo:[:anIndex :aLabel|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5645
            disabledRawLabel at:anIndex put:(block value:aLabel)
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5646
        ]
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5647
    ] ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5648
        disabledRawLabel := block value:rawLabel
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  5649
    ].
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  5650
    ^ disabledRawLabel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  5651
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  5652
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  5653
fetchDeviceResources
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  5654
    disabledRawLabel := nil.
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  5655
    self fetchImages.
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  5656
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  5657
    font notNil ifTrue:[
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  5658
        font := font onDevice:(menuPanel device)
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  5659
    ].
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  5660
!
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  5661
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  5662
fetchImages
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  5663
    "fetch images
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  5664
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5665
    |icon block|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5666
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5667
    rawLabel notNil ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5668
        block := [:el| |rslt|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5669
            (rslt := el) notNil ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5670
                el isImageOrForm ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5671
                    rslt := menuPanel imageOnDevice:el
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5672
                ] ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5673
                    el class == LabelAndIcon ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5674
                        (icon := el image) notNil ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5675
                            el image:(menuPanel imageOnDevice:icon)
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5676
                        ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5677
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5678
                        (icon := el icon) notNil ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5679
                            el icon:(menuPanel imageOnDevice:icon)
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5680
                        ]
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5681
                    ]
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5682
                ]
1709
0bc103eb4143 separtaor - label
ca
parents: 1708
diff changeset
  5683
            ].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5684
            rslt
1709
0bc103eb4143 separtaor - label
ca
parents: 1708
diff changeset
  5685
        ].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5686
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5687
        rawLabel isArray ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5688
            rawLabel keysAndValuesDo:[:anIndex :aLabel|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5689
                rawLabel at:anIndex put:(block value:aLabel)
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5690
            ]
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5691
        ] ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5692
            rawLabel := block value:rawLabel
1709
0bc103eb4143 separtaor - label
ca
parents: 1708
diff changeset
  5693
        ]
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  5694
    ].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5695
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5696
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5697
updateAccessCharacterFor:aLabel
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5698
    |s i rest label pos|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5699
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5700
    (accessCharacter notNil or:[aLabel isNil]) ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5701
        ^ aLabel
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5702
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5703
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5704
    aLabel isString ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5705
        aLabel class == LabelAndIcon ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5706
            aLabel string:(self updateAccessCharacterFor:(aLabel string))
1709
0bc103eb4143 separtaor - label
ca
parents: 1708
diff changeset
  5707
        ].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5708
        ^ aLabel
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5709
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5710
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5711
    s := aLabel size.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5712
    i := 1.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5713
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5714
    label := aLabel.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5715
    pos := accessCharacterPosition.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5716
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5717
    [((i := label indexOf:$& startingAt:i) ~~ 0 and:[i < s])] whileTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5718
        rest := label copyFrom:(i+1).
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5719
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5720
        i == 1 ifTrue:[label := rest]
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5721
              ifFalse:[label := (label copyFrom:1 to:(i-1)), rest].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5722
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5723
        (label at:i) == $& ifTrue:[i := i + 1] ifFalse:[pos := i].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5724
        s := s - 1.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5725
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5727
    (pos isNil or:[(accessCharacter := label at:pos ifAbsent:nil) isNil]) ifTrue:[
1762
840521c06b92 bugfix for && in label
ca
parents: 1750
diff changeset
  5728
        ^ label
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5729
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5730
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5731
    label isText ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5732
        label := Text string:label
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5733
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5734
    label emphasisAt:pos add:#underline.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5735
  ^ label
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5736
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5737
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5738
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  5739
!MenuPanel::Item methodsFor:'printing & storing'!
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  5740
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  5741
displayString
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  5742
    ^ self class name, '[', label printString, ']'
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  5743
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  5744
! !
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  5745
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5746
!MenuPanel::Item methodsFor:'private'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5747
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  5748
activeBackgroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  5749
    "returns the active background color derived from menuPanel
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  5750
    "
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  5751
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  5752
    isButton ifTrue: [^menuPanel buttonActiveBackgroundColor].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  5753
    ^menuPanel activeBackgroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  5754
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  5755
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  5756
activeForegroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  5757
    "returns the active foreground color derived from menuPanel
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  5758
    "
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  5759
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  5760
    ^menuPanel activeForegroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  5761
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  5762
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  5763
backgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  5764
    "returns the background color derived from menuPanel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  5765
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  5766
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  5767
    isButton ifTrue: [^menuPanel buttonPassiveBackgroundColor].
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  5768
    ^menuPanel backgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  5769
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  5770
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5771
backgroundColorFromLabel
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5772
    "returns the background color derived from label or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5773
    "
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5774
    |run|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5775
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5776
    label isText ifFalse:[^ nil ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5777
    run := label emphasis.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5778
    run size == 0 ifTrue:[^ nil ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5779
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5780
    run := run first.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5781
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5782
    run size == 0 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5783
	(run value isColor and:[run key == #backgroundColor]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5784
	    ^ run value
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5785
	]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5786
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5787
	run do:[:r|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5788
	    (r value isColor and:[r key == #backgroundColor]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5789
		^ r value
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5790
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5791
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5792
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5793
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5794
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5795
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  5796
buttonEnteredBackgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  5797
    "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
  5798
     derived from menuPanel
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  5799
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  5800
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  5801
    isButton ifTrue: [^ menuPanel buttonEnteredBackgroundColor].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  5802
    ^ menuPanel backgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  5803
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  5804
    "Created: / 20.8.1998 / 13:56:10 / cg"
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  5805
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  5806
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5807
choiceForm
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5808
    "returns choice form or nil
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5809
    "
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5810
    |isOn|
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5811
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5812
    choice isNil ifTrue:[^ nil].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5813
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5814
    isOn := choice value = choiceValue.
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5815
    self enabled ifFalse:[
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5816
        ^ isOn ifTrue:[menuPanel iconRadioGroupDisabledOn]
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5817
               ifFalse:[menuPanel iconRadioGroupDisabledOff]
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5818
    ].
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5819
    ^ isOn ifTrue:[menuPanel iconRadioGroupOn]
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5820
           ifFalse:[menuPanel iconRadioGroupOff]
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5821
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5822
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  5823
findSubMenuIn:aRecv
1051
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  5824
    "ask the receiver for a submenu aspect, sending it
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  5825
     #aspectFor: first; then trying the selector itself.
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  5826
     Ignore the error if that message is not understood
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  5827
     (but not other message-not-understoods)"
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  5828
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5829
    |subm sel num|
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5830
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5831
    aRecv isNil ifTrue:[^ nil].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5832
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5833
    sel := submenuChannel asSymbol.
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5834
    num := sel numArgs.
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5835
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5836
    num == 0 ifTrue:[
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5837
        Object messageNotUnderstoodSignal handle:[:ex|
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5838
            |selector|
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5839
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5840
            ((selector := ex parameter selector) == sel
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5841
            or:[selector == #aspectFor:]) ifFalse:[
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5842
                ex reject
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  5843
            ].
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5844
        ] do:[
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  5845
            subm := aRecv aspectFor:sel.
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5846
        ].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5847
        subm notNil ifTrue:[^ subm].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5848
    ].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5849
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  5850
    Object messageNotUnderstoodSignal handle:[:ex|
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5851
        ex parameter selector == sel ifFalse:[ ex reject ]
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5852
    ] do:[
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5853
                 num == 0 ifTrue:[subm := aRecv perform:sel]
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5854
        ifFalse:[num == 1 ifTrue:[subm := aRecv perform:sel with:(argument ? menuPanel)]
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5855
        ifFalse:[                 subm := aRecv perform:sel with:argument with:menuPanel]]
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5856
    ].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5857
    subm notNil ifTrue:[^ subm].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5858
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5859
    Object messageNotUnderstoodSignal handle:[:ex| 
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5860
        ex parameter selector == sel ifFalse:[ ex reject ].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5861
    ] do:[
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5862
                 num == 0 ifTrue:[subm := aRecv class perform:sel]
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5863
        ifFalse:[num == 1 ifTrue:[subm := aRecv class perform:sel with:(argument ? menuPanel)]
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5864
        ifFalse:[                 subm := aRecv class perform:sel with:argument with:menuPanel]]
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5865
    ].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5866
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  5867
    ^ subm
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  5868
!
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  5869
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5870
indicationValue
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5871
    "returns indication value or nil in case of no indication
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5872
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5873
    |numArgs sel recv|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5874
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5875
    indication isNil ifTrue:[^ nil].                                    "no indication specified"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5876
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5877
    indication isSymbol ifFalse:[                                       
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5878
        ^ indication value == true                                      "block or model"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5879
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5880
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5881
    (numArgs := indication numArgs) == 2 ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5882
        recv := menuPanel receiver.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5883
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5884
        (recv isValueModel) ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5885
            (recv notNil or:[(recv := menuPanel application) notNil]) ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5886
                sel := indication copyFrom:1 to:(indication indexOf:$:).
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5887
                sel := sel asSymbol.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5888
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5889
                Object messageNotUnderstoodSignal handle:[:ex| 
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5890
                    ex parameter selector == sel ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5891
                        ex reject
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  5892
                    ].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5893
                ] do:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5894
                    sel := recv perform:sel with:argument
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5895
                ]
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  5896
            ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  5897
        ].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5898
        ^ sel value == true
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5899
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5900
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5901
    numArgs ~~ 0 ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5902
        sel := (indication copyWithoutLast:1) asSymbol
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5903
    ] ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5904
        sel := indication
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5905
    ].    
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5906
    sel := self aspectAt:sel.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5907
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5908
    sel isValueModel ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5909
        indication := sel.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5910
        indication addDependent:self.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5911
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5912
    ^ sel value == true
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5913
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5914
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5915
indicationValue:aValue
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  5916
    "set the indication value
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5917
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5918
    |numArgs recv|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5919
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5920
    indication isNil ifTrue:[^ self].                                   "no indication specified"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5921
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5922
    indication isSymbol ifFalse:[                                       
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5923
        indication perform:#value: with:aValue ifNotUnderstood:nil.     "block or model"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5924
      ^ self
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5925
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5926
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5927
    (numArgs := indication numArgs) == 0 ifTrue:[                       "no arguments to selector; cannot set"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5928
        ^ self
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  5929
    ].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  5930
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5931
    recv := menuPanel receiver.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5932
    recv isValueModel ifTrue:[^ self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5933
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  5934
    recv isNil ifTrue:[
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5935
        recv := menuPanel application.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5936
        recv isNil ifTrue:[^ self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5937
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5938
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5939
    Object messageNotUnderstoodSignal handle:[:ex| 
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5940
        (ex parameter selector ~~ indication) ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5941
            ex reject
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  5942
        ].
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  5943
        ('MenuPanel [info]: application does not respond to ' , indication) infoPrintCR.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5944
    ] do:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5945
        numArgs == 1 ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5946
            recv perform:indication with:aValue
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5947
        ] ifFalse:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5948
            recv perform:indication with:(argument ? self) with:aValue
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5949
        ]
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5950
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5951
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5952
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5953
indicatorForm
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5954
    "returns indication form or nil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5955
    "
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5956
    |val|
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5957
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5958
    indication isNil ifTrue:[^ nil].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5959
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5960
    val := self indicationValue.
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5961
    self enabled ifFalse:[
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5962
        ^ val == true 
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5963
            ifTrue:[menuPanel iconIndicationDisabledOn]
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5964
            ifFalse:[menuPanel iconIndicationDisabledOff]
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5965
    ].
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5966
    ^ val == true 
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5967
        ifTrue:[menuPanel iconIndicationOn]
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  5968
        ifFalse:[menuPanel iconIndicationOff]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5969
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5970
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  5971
isEntered
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  5972
    "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
  5973
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  5974
    ^ menuPanel enteredItem == self
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  5975
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  5976
    "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
  5977
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  5978
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5979
separatorType
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5980
    "returns type of separator line or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5981
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5982
    |c lbl|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5983
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5984
    rawLabel isNil ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5985
	^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5986
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5987
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5988
    (lbl := label value) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5989
	^ #singleLine
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5990
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5991
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5992
    lbl size == 1 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5993
	c := lbl first.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5994
	c == $- ifTrue:[^ #singleLine].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5995
	c == $= ifTrue:[^ #doubleLine].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5996
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5997
  ^ #blankLine
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5998
!
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5999
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  6000
setupSubmenu
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  6001
    |appl recv subm|
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  6002
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  6003
    submenuChannel notNil ifTrue:[
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6004
        submenuChannel isSymbol ifFalse:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6005
            subm := submenuChannel
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6006
        ] ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6007
            appl := menuPanel application.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6008
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6009
            (subm := self findSubMenuIn:appl) isNil ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6010
                (recv := menuPanel receiver) ~~ appl ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6011
                    subm := self findSubMenuIn:recv
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6012
                ]
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6013
            ]
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6014
        ].
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6015
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6016
        (subm := subm value) isArray ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6017
            subm := Menu new fromLiteralArrayEncoding:subm.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6018
            "/ cg: linked menus also may contain translations ...
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6019
            subm notNil ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6020
                appl notNil ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6021
                    subm findGuiResourcesIn:appl.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6022
                ]                
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6023
            ].
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6024
        ].
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6025
        self submenu:subm.
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  6026
    ].
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  6027
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  6028
    ^ subMenu
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  6029
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  6030
    "Modified: / 19.5.1998 / 19:36:56 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6031
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6032
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6033
!MenuPanel::Item methodsFor:'queries'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6034
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  6035
canChangeVisibility
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6036
    "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
  6037
     otherwise there is a change notification raised if the model changed
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6038
    "
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6039
    ^ isVisible isSymbol
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6040
"/  ^ isVisible notNil and:[isVisible ~~ true]
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  6041
!
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  6042
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6043
canSelect
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6044
    "returns true if item is selectable; no separator, visible and enabled.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6045
     in case of a choice (RadioButton) i have to check for the choiceValue
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6046
    "
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6047
    (rawLabel notNil and:[self isVisible and:[self enabled]]) ifTrue:[
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6048
        (choice isNil or:[choice value ~= choiceValue]) ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6049
            ^ true
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6050
        ].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  6051
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  6052
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6053
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6054
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6055
containsPointX:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6056
    "returns true if point is contained in my layout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6057
    "
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6058
    (self isVisible and:[layout notNil]) ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6059
        ^ layout containsPointX:x y:y
505
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  6060
    ].
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  6061
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6062
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6063
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6064
hasIndication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6065
    "returns true if on/off indication exists
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6066
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6067
    ^ indication notNil
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6068
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6069
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6070
hasSubmenu
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  6071
    "returns true if the item is configured as an subMenu entry
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6072
    "
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  6073
    ^ subMenu notNil or:[submenuChannel notNil]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6074
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6075
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6076
isEnabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6077
    "returns enabled state
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6078
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6079
    ^ self enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6080
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6081
1723
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  6082
isLabeledItem
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  6083
    "returns true if the item is no button and no separator
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  6084
    "
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  6085
    ^ rawLabel notNil and:[isButton not]
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  6086
!
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  6087
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  6088
isSeparator
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  6089
    "returns true if item is a separator
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  6090
    "
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  6091
    ^ rawLabel isNil
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  6092
!
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  6093
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6094
isVisible
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6095
    "returns the visibility state
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6096
    "
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6097
    |state|
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6098
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6099
    isVisible isSymbol ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6100
        state := self aspectAt:isVisible.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6101
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6102
        state isValueModel ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6103
            isVisible := state.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6104
            isVisible addDependent:self.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6105
            state := isVisible.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6106
        ]
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6107
    ] ifFalse:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6108
        state := isVisible
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  6109
    ].
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  6110
  ^ state value ~~ false
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  6111
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  6112
    "Modified: / 5.10.1998 / 12:08:28 / cg"
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6113
!
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6114
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6115
isVisible:something
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6116
    "change the state; if the state changed, a redraw is performed
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6117
    "
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6118
    |oldState newState|
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6119
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6120
    isVisible isNil ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6121
        oldState := true
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6122
    ] ifFalse:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6123
        oldState := isVisible value.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6124
        isVisible isValueModel ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6125
            isVisible removeDependent:self
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6126
        ]
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6127
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6128
    isVisible := something.
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6129
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6130
    isVisible isNil ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6131
        newState := true
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6132
    ] ifFalse:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6133
        isVisible isValueModel ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6134
            isVisible addDependent:self
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6135
        ] ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6136
            isVisible isSymbol ifTrue:[^ self]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6137
        ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6138
        menuPanel shown ifFalse:[^ self].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6139
        newState := isVisible value.
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6140
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6141
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6142
    newState ~~ oldState ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6143
        menuPanel mustRearrange
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6144
    ]
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  6145
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  6146
    "Modified: / 5.10.1998 / 12:12:04 / cg"
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6147
!
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6148
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6149
shortcutKeyAsString
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6150
    "converts shortcutKey to a text object
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6151
    "
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6152
    |nm prefix|
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6153
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6154
    shortcutKey isNil ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6155
        ^ nil
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6156
    ].
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6157
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6158
    shortcutKey isCharacter ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6159
        nm := shortcutKey asString
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6160
    ] ifFalse:[
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6161
        "/ this is somewhat complicated: we have the symbolic key at hand,
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6162
        "/ but want to show the untranslated (inverse keyBoardMapped) key & modifier
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6163
        "/ Ask the devices keyboardMap for the backtranslation.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6164
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6165
        nm := menuPanel device keyboardMap keyAtValue:shortcutKey ifAbsent:shortcutKey.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6166
        "/
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6167
        "/ some modifier-key combination ?
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6168
        "/
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6169
        (nm startsWith:#Cmd) ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6170
            prefix := #Cmd.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6171
        ] ifFalse:[(nm startsWith:#Alt) ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6172
            prefix := #Alt.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6173
        ] ifFalse:[(nm startsWith:#Meta) ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6174
            prefix := #Meta.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6175
        ] ifFalse:[(nm startsWith:#Ctrl) ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6176
            prefix := #Ctrl.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6177
        ]]]].
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6178
        prefix notNil ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6179
            nm := (self shortcutKeyPrefixFor:prefix), (nm copyFrom:(prefix size + 1))
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6180
        ] ifFalse:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6181
            nm := nm asString
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  6182
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6183
    ].
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  6184
    ^ nm
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6185
987
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  6186
    "Modified: / 17.7.1998 / 11:56:40 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6187
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6188
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6189
shortcutKeyPrefixFor:aModifier
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6190
    "returns prefix assigned to a modifier
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6191
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6192
    |m|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6193
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6194
    m := menuPanel device modifierKeyTopFor:aModifier.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6195
    m notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  6196
	^ m , '-'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6197
    ].
987
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  6198
    ^ aModifier , '-'.
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  6199
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  6200
    "Modified: / 17.7.1998 / 11:56:46 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6201
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6202
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6203
!MenuPanel::Item methodsFor:'selection'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6204
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6205
isSelected
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6206
    "returns true if item is selected
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6207
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6208
    ^ menuPanel selection == self
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6209
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6210
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6211
selected:isSelected
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  6212
    "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
  6213
     submenu and perform a redraw
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  6214
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6215
    menuPanel isNil ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6216
        ^ self hideSubmenu
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6217
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6218
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6219
    isSelected ifFalse:[
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6220
        self invalidate.
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  6221
        self hideSubmenu.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6222
    ] ifTrue:[
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6223
        menuPanel realized ifTrue:[
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6224
            (indication isNil or:[isButton not]) ifTrue:[
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6225
                self invalidate
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6226
            ].
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6227
1788
e1f32720fbb4 donot automatically open the submenu of a popup menu
ca
parents: 1787
diff changeset
  6228
            (menuPanel isPopUpView not or:[menuPanel openMenuOnSelect]) ifTrue:[
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6229
                (subMenu := self setupSubmenu) notNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6230
                    self openSubmenu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6231
                ]
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6232
            ]
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6233
        ]
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6234
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6235
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6236
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6237
!MenuPanel class methodsFor:'documentation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6238
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6239
version
1923
530426a3d692 support #level:
ca
parents: 1922
diff changeset
  6240
    ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.263 2001-01-30 18:49:20 ca Exp $'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6241
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6242
MenuPanel initialize!