MenuPanel.st
author Claus Gittinger <cg@exept.de>
Fri, 24 Oct 2008 16:14:42 +0200
changeset 3565 8147249b4aa6
parent 3561 c1db3c0aab04
child 3580 e9fe446dc779
permissions -rw-r--r--
better icons
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2005
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     1
"
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     2
 COPYRIGHT (c) 1997 by eXept Software AG
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
     3
	      All Rights Reserved
2005
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     4
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     5
 This software is furnished under a license and may be used
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     6
 only in accordance with the terms of that license and with the
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     9
 other person.  No title to or ownership of the software is
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    10
 hereby transferred.
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    11
"
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
    12
"{ Package: 'stx:libwidg2' }"
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
    13
2182
59a770bbb95a changed superclass to View (to inherit model)
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
    14
View subclass:#MenuPanel
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    15
	instanceVariableNames:'adornment shadowView mapTime mustRearrange superMenu
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    16
		shortKeyInset selection items groupSizes receiver enabled
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    17
		lastActiveMenu enteredItem prevFocusView previousPointerGrab
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    18
		previousKeyboardGrab relativeGrabOrigin hasImplicitGrap
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    19
		scrollActivity rightArrowShadow rightArrow fgColor verticalLayout
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    20
		showSeparatingLines showGroupDivider implicitGrabView
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    21
		lastPointerView openDelayedMenuBlock preferredWidth application
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    22
		originator centerItems hideOnRelease defaultHideOnRelease
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    23
		buttonInsetX buttonInsetY itemSpace activeBackgroundColor
3328
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
    24
		stringOffsetX doAccessCharacterTranslation'
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    25
	classVariableNames:'InitialSelectionQuerySignal Images LigthenedImages
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    26
		DefaultForegroundColor DefaultBackgroundColor IconIndicationOn
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    27
		IconIndicationOff IconRadioOn IconRadioOff
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    28
		IconDisabledIndicationOn IconDisabledIndicationOff
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    29
		IconDisabledRadioOn IconDisabledRadioOff'
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    30
	poolDictionaries:''
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    31
	category:'Views-Menus'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    32
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    33
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    34
Object subclass:#Item
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    35
	instanceVariableNames:'menuItem layout menuPanel subMenu displayLabel displayLabelExtent
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    36
		disabledDisplayLabel enableChannel label activeHelpText
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    37
		flyByHelpText isVisible indication choice accessCharacter'
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    38
	classVariableNames:'HorizontalInset VerticalInset HorizontalButtonInset
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    39
		VerticalButtonInset LabelRightOffset VerticalPopUpInset'
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    40
	poolDictionaries:''
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    41
	privateIn:MenuPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    42
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    43
2692
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
    44
Object subclass:#Adornment
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    45
	instanceVariableNames:'indication accessCharacterPosition shortcutKey argument argument2
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    46
		choice choiceValue'
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    47
	classVariableNames:''
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    48
	poolDictionaries:''
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    49
	privateIn:MenuPanel::Item
2692
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
    50
!
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
    51
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
    52
Object subclass:#ScrollActivity
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    53
	instanceVariableNames:'semaLock activeMenu scrollTask direction icons'
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    54
	classVariableNames:''
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    55
	poolDictionaries:''
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    56
	privateIn:MenuPanel
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
    57
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
    58
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    59
!MenuPanel class methodsFor:'documentation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    60
2005
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    61
copyright
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    62
"
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    63
 COPYRIGHT (c) 1997 by eXept Software AG
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    64
	      All Rights Reserved
2005
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    65
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    66
 This software is furnished under a license and may be used
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    67
 only in accordance with the terms of that license and with the
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    68
 inclusion of the above copyright notice.   This software may not
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    69
 be provided or otherwise made available to, or used by, any
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    70
 other person.  No title to or ownership of the software is
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    71
 hereby transferred.
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    72
"
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    73
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    74
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    75
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    76
documentation
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    77
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    78
    a menu panel used for both pull-down-menus and pop-up-menus.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    79
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
    80
    this will eventually replace most of the MenuView and PopUpMenu stuff.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    81
    (and hopefully be ST-80 compatible ...)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    82
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    83
    To create a menu, there exists a MenuEditor which will generate
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    84
    a menu specification.
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    85
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    86
2061
faf64f2cd28e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2059
diff changeset
    87
    Notice:
faf64f2cd28e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2059
diff changeset
    88
        This is going to replace the obsolete MenuView.
faf64f2cd28e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2059
diff changeset
    89
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    90
    [author:]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    91
        Claus Atzkern
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    92
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    93
    [see also:]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    94
        Menu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    95
        MenuItem
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    96
        MenuEditor
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
    97
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
    98
    cg: this code is so ugly - needs a complete rewrite...
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
    99
388
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
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
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.
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   148
										[exEnd]
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   149
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   150
										[exBegin]
1767
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.
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
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
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
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
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
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
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
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:
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   214
	#(#Menu #( #(#MenuItem 
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   215
		    #label: 'File' 
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   216
		    #submenu:
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   217
		      #(#Menu #(#(#MenuItem #label: 'quit' #value:#quit )     
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   218
				 (#MenuItem 
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   219
				    #label: 'edit' 
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   220
				    #submenu:
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   221
				      #(#Menu #( #(#MenuItem #label: 'edit'  #value:#edit )     
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   222
						 #(#MenuItem #label: 'close' #value:#close)     
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   223
					       )
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   224
					       nil
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   225
					       nil
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   226
				       )     
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   227
				  )
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   228
				 #(#MenuItem #label: 'help' #value:#help )     
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   229
			       )
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   230
			       nil
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   231
			       nil
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   232
		       )     
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   233
		 ) 
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   234
		#(#MenuItem #label: 'Inspect' #value:#inspectMenu ) 
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   235
		#(#MenuItem #label: 'Bar' 
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   236
			    #submenu:
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   237
			       #(#Menu #( #(#MenuItem #label: 'bar 1' #value:#bar1 )     
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   238
					  #(#MenuItem #label: 'bar 2' #value:#bar2 )     
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   239
					)
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   240
					nil
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   241
					nil
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   242
				)     
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   243
		 ) 
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   244
	      ) 
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   245
	      #( 2 )
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   246
	      nil
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
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).
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
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:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   267
	menu := Menu new.
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   268
	menu receiver:aReceiver.
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   269
	menu fromLiteralArrayEncoding:aSpec.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   270
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   271
  ^ self menu:menu receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   272
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   273
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   274
labels:labels
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   275
    ^ self labels:labels nameKeys:nil receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   276
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   277
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   278
labels:labels nameKeys:nameKeys
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   279
    ^ self labels:labels nameKeys:nameKeys receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   280
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   281
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   282
labels:labels nameKeys:nameKeys receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   283
    |mview|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   284
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   285
    mview := self menu:nil receiver:aReceiver.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   286
    mview labels:labels.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   287
    mview nameKeys:nameKeys.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   288
  ^ mview
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   289
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   290
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   291
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   292
labels:labels receiver:aReceiver
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   293
    ^ self labels:labels nameKeys:nil receiver:aReceiver
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   294
!
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   295
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   296
menu:aMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   297
    ^ self menu:aMenu receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   298
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   299
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   300
menu:aMenu receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   301
    |mview|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   302
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   303
    mview := self new.
1955
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   304
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   305
    (aMenu notNil and:[aMenu receiver isNil]) ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   306
	"/ no receiver specified in the menu; thus set the receiver immediately
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   307
	mview receiver:aReceiver
1955
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   308
    ].
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   309
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   310
    mview menu:aMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   311
1955
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   312
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   313
"/ a menu itself may contain a receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   314
"/ thus we do not overwrite the receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   315
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   316
    aReceiver notNil ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   317
	mview receiver:aReceiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   318
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   319
  ^ mview
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   320
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   321
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   322
!MenuPanel class methodsFor:'class initialization'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   323
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   324
initialize
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   325
    InitialSelectionQuerySignal isNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   326
        InitialSelectionQuerySignal := QuerySignal new.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   327
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   328
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   329
    "
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   330
     self initialize
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   331
    "
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   332
660
d1670dfe5445 Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents: 658
diff changeset
   333
    "Modified: / 15.1.1998 / 23:08:31 / stefan"
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   334
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   335
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   336
preSnapshot
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   337
    "remove all resources"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   338
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   339
    Images := nil.
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   340
    LigthenedImages := nil.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   341
! !
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   342
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   343
!MenuPanel class methodsFor:'default icons'!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   344
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   345
delayedMenuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   346
    "This resource specification was automatically generated
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   347
     by the ImageEditor of ST/X."
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   348
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   349
    "Do not manually edit this!! If it is corrupted,
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   350
     the ImageEditor may not be able to read the specification."
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   351
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   352
    "
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   353
     self delayedMenuIndicator inspect
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   354
     ImageEditor openOnClass:self andSelector:#delayedMenuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   355
     Icon flushCachedIcons
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   356
    "
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   357
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   358
    <resource: #image>
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   359
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   360
    ^Icon
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   361
        constantNamed:#'MenuPanel class delayedMenuIndicator'
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   362
        ifAbsentPut:[(Depth1Image new) width: 7; height: 6; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@HCB') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 7; height: 6; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@J+V[C P') ; yourself); yourself]
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   363
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   364
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   365
iconIndicationDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   366
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   367
     by the ImageEditor of ST/X."
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
    "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
   370
     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
   371
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
     self iconIndicationDisabledOff inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   374
     ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOff
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
    <resource: #image>
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   378
2755
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   379
    IconDisabledIndicationOff isNil ifTrue:[
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   380
        IconDisabledIndicationOff := Icon
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   381
            constantNamed:#'MenuPanel iconIndicationDisabledOff'
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   382
            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]
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   383
    ].
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   384
    ^ IconDisabledIndicationOff
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   385
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   386
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   387
iconIndicationDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   388
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   389
     by the ImageEditor of ST/X."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   390
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   391
    "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
   392
     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
   393
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   394
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   395
     self iconIndicationDisabledOn inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   396
     ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   397
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   398
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   399
    <resource: #image>
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   400
2755
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   401
    IconDisabledIndicationOn isNil ifTrue:[
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   402
        IconDisabledIndicationOn := Icon
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   403
            constantNamed:#'MenuPanel iconIndicationDisabledOn'
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   404
            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]
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   405
    ].
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   406
    ^ IconDisabledIndicationOn
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   407
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   408
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   409
iconIndicationOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   410
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   411
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   412
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   413
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   414
     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
   415
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   416
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   417
     self iconIndicationOff inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   418
     ImageEditor openOnClass:self andSelector:#iconIndicationOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   419
    "
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
    <resource: #image>
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   422
2752
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   423
    IconIndicationOff isNil ifTrue:[
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   424
        IconIndicationOff := Icon
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   425
            constantNamed:#'MenuPanel iconIndicationOff'
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   426
            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]
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   427
    ].
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   428
    ^ IconIndicationOff
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   429
!
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   430
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   431
iconIndicationOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   432
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   433
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   434
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   435
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   436
     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
   437
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   438
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   439
     self iconIndicationOn inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   440
     ImageEditor openOnClass:self andSelector:#iconIndicationOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   441
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   442
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   443
    <resource: #image>
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   444
2752
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   445
    IconIndicationOn isNil ifTrue:[
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   446
        IconIndicationOn := Icon
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   447
                constantNamed:#'MenuPanel iconIndicationOn'
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   448
                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]
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   449
    ].
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   450
    ^ IconIndicationOn
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   451
!
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   452
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   453
iconRadioGroupDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   454
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   455
     by the ImageEditor of ST/X."
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
    "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
   458
     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
   459
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   460
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   461
     self iconRadioGroupDisabledOff inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   462
     ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   463
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   464
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   465
"/    <resource: #image>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   466
"/
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   467
"/    IconDisabledRadioOff isNil ifTrue:[
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   468
"/        IconDisabledRadioOff := Icon
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   469
"/            constantNamed:#'MenuPanel iconRadioGroupDisabledOff'
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   470
"/            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]
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   471
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   472
"/    ^ IconDisabledRadioOff
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   473
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   474
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   475
    ^ RadioButton disabledPassiveForm
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   476
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   477
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   478
iconRadioGroupDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   479
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   480
     by the ImageEditor of ST/X."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   481
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   482
    "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
   483
     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
   484
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   485
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   486
     self iconRadioGroupDisabledOn inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   487
     ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOn
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
   488
     Icon flushCachedIcons
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   489
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   490
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   491
"/    <resource: #image>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   492
"/
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   493
"/    IconDisabledRadioOn isNil ifTrue:[
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   494
"/        IconDisabledRadioOn := Icon
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   495
"/            constantNamed:#'MenuPanel class iconRadioGroupDisabledOn'
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   496
"/            ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@AUP@@E@AP@DJ*Y@DYUZ(AIUU+AIUUVLRUUU#D%UUX1IUUVLRUUU#AYUU#@Z%U(0A** 0@C@C0@@O?@@') ; colorMapFromArray:#[0 0 0 85 85 85 170 170 170 255 255 255]; mask:((Depth1Image new) width: 15; height: 15; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A<@_<C?8_?1??O?:??+?>/?:??)?=G?4O< HL@_@') ; yourself); yourself]
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   497
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   498
"/    ^ IconDisabledRadioOn
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   499
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   500
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   501
    ^ RadioButton disabledActiveForm
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   502
!
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   503
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   504
iconRadioGroupEnteredOff
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   505
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   506
    ^ RadioButton enteredPassiveForm
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   507
!
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   508
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   509
iconRadioGroupEnteredOn
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   510
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   511
    ^ RadioButton enteredActiveForm
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   512
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   513
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   514
iconRadioGroupOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   515
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   516
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   517
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   518
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   519
     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
   520
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   521
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   522
     self iconRadioGroupOff inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   523
     ImageEditor openOnClass:self andSelector:#iconRadioGroupOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   524
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   525
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   526
"/    <resource: #image>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   527
"/
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   528
"/    IconRadioOff isNil ifTrue:[
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   529
"/        IconRadioOff := Icon
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   530
"/            constantNamed:#'MenuPanel iconRadioGroupOff'
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   531
"/            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]
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   532
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   533
"/    ^ IconRadioOff
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   534
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   535
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   536
    ^ RadioButton passiveForm
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   537
!
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   538
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   539
iconRadioGroupOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   540
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   541
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   542
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   543
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   544
     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
   545
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   546
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   547
     self iconRadioGroupOn inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   548
     ImageEditor openOnClass:self andSelector:#iconRadioGroupOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   549
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   550
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   551
"/    <resource: #image>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   552
"/
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   553
"/    IconRadioOn isNil ifTrue:[
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   554
"/        IconRadioOn := Icon
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   555
"/            constantNamed:#'MenuPanel iconRadioGroupOn'
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   556
"/            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]
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   557
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   558
"/    ^ IconRadioOn
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   559
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   560
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   561
    ^ RadioButton activeForm
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   562
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   563
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   564
menuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   565
    "This resource specification was automatically generated
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   566
     by the ImageEditor of ST/X."
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   567
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   568
    "Do not manually edit this!! If it is corrupted,
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   569
     the ImageEditor may not be able to read the specification."
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   570
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   571
    "
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   572
     self menuIndicator inspect
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   573
     ImageEditor openOnClass:self andSelector:#menuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   574
     Icon flushCachedIcons
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   575
    "
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   576
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   577
    <resource: #image>
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   578
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   579
    ^Icon
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   580
        constantNamed:#'MenuPanel::Item class menuIndicator'
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   581
        ifAbsentPut:[(Depth1Image new) width: 7; height: 4; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@B@0 @a') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 7; height: 4; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?''08D@@a') ; yourself); yourself]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   582
! !
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   583
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   584
!MenuPanel class methodsFor:'defaults'!
450
ac72eb2ed895 initialize fix
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   585
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   586
defaultBackgroundColor
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
   587
    DefaultBackgroundColor notNil ifTrue:[^ DefaultBackgroundColor].
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   588
    ^ StyleSheet at:#'pullDownMenu.backgroundColor' default:DefaultViewBackgroundColor.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   589
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   590
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   591
defaultLevel
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   592
    ^ StyleSheet at:#'pullDownMenu.level' default:1
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   593
"
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   594
self defaultLevel
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   595
"
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   596
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   597
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   598
delayedMenuIndicatorOffset
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   599
    "returns an additional offset between the label and the
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   600
     delayedMenu indication (i.e. the down-arrow icon)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   601
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   602
    ^ 1 "2"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   603
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   604
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   605
maxShortCutSearchLevel
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   606
    "1 means: only search in top items.
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   607
     2 means: search one level of menus.
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   608
     used to be 10"
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   609
3384
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   610
    MaxShortCutSearchLevel isNil ifTrue:[MaxShortCutSearchLevel := 2.].
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   611
    ^ MaxShortCutSearchLevel
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   612
!
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   613
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   614
maxShortCutSearchLevel: anInteger
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   615
    "1 means: only search in top items.
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   616
     2 means: search one level of menus."
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   617
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   618
    MaxShortCutSearchLevel := anInteger
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   619
!
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   620
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   621
menuIndicatorOffset
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   622
    "returns an additional offset between the label and the
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   623
     delayedMenu indication (i.e. the down-arrow icon)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   624
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   625
    ^ 1 "2"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   626
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   627
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   628
mnemonicIdentifier
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   629
    "returns the identifier each mnemonic starts with;
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   630
     ex:
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   631
        &File   mnemonic := Cmdf
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   632
        F&ile   mnemonic := Cmdi
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   633
        ....."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   634
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   635
    ^ 'Cmd'
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   636
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   637
450
ac72eb2ed895 initialize fix
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   638
updateStyleCache
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
   639
    "extract values from the styleSheet and cache them in class variables"
657
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   640
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   641
    <resource: #style (
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   642
        #'popup.borderWidth' #'popup.level' 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   643
        #'selection.disabledForegroundColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   644
        #'pullDownMenu.foregroundColor' #'pullDownMenu.backgroundColor' #'pullDownMenu.level'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   645
        #'menu.itemHorizontalSpace' #'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace'
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   646
        #'menu.itemSpace' #'menu.buttonItemVerticalSpace'
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   647
        #'menu.buttonActiveLevel' #'menu.buttonPassiveLevel' #'menu.buttonEnteredLevel'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   648
        #'menu.hilightLevel' #'menu.enteredLevel'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   649
        #'menu.groupDividerSize' #'menu.itemMargin'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   650
        #'menu.disabledEtchedForegroundColor' #'menu.hilightForegroundColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   651
        #'menu.enteredBackgroundColor' #'menu.enteredForegroundColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   652
        #'menu.disabledForegroundColor' #'menu.buttonEnteredBackgroundColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   653
        #'menu.selectionFollowsMouse'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   654
        #'button.disabledEtchedForegroundColor' #'button.disabledForegroundColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   655
        #'button.activeBackgroundColor' #'button.backgroundColor' #'button.lightColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   656
        #'button.enteredBackgroundColor' #'button.halfLightColor' #'button.halfShadowColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   657
        #'button.activeLevel' #'button.passiveLevel' #'button.edgeStyle'
2752
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   658
        #'menu.iconIndicationOn' #'menu.iconIndicationOff'
2754
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   659
        #'menu.iconIndicationOn.bitmapFile' #'menu.iconIndication.bitmapOffFile'
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   660
        #'menu.iconRadioOn' #'menu.iconRadioOff'
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   661
        #'menu.iconRadioOn.bitmapFile' #'menu.iconRadioOff.bitmapFile'
2755
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   662
        #'menu.iconDisabledIndicationOn' #'menu.iconDisabledIndicationOff'
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   663
        #'menu.iconDisabledIndicationOn.bitmapFile' #'menu.iconDisabledIndication.bitmapOffFile'
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   664
        #'menu.iconDisabledRadioOn' #'menu.iconDisabledRadioOff'
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   665
        #'menu.iconDisabledRadioOn.bitmapFile' #'menu.iconDisabledRadioOff.bitmapFile'
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   666
    )>
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   667
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   668
    |styleSheet style var foregroundColor backgroundColor buttonPassiveBackgroundColor
2754
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   669
    buttonActiveLevel buttonPassiveLevel buttonEnteredLevel getBitmapOrFile|
2607
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   670
2611
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   671
    "clear DefaultBackgroundColor caused by accessing the #defaultBackgroundColor
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   672
     which returns the default cashed DefaultBackgroundColor
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   673
    "
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   674
    DefaultBackgroundColor := nil.
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   675
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   676
    MenuView            updateStyleCache.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   677
    SelectionInListView updateStyleCache.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   678
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   679
    styleSheet  := StyleSheet.
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   680
    style       := styleSheet name.
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   681
2607
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   682
    DefaultFont     := MenuView defaultFont.
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   683
    foregroundColor := DefaultForegroundColor := styleSheet colorAt:#'pullDownMenu.foregroundColor' 
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   684
                                                            default:[styleSheet 
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   685
                                                                        colorAt:#'menu.foregroundColor'
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   686
                                                                        default:Color black].
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
   687
    backgroundColor := DefaultBackgroundColor := self defaultBackgroundColor.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   688
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   689
    var := styleSheet colorAt:#'menu.hilightBackgroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   690
    var isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   691
        style == #motif ifTrue:[ var := backgroundColor ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   692
                       ifFalse:[ var := styleSheet is3D ifFalse:[foregroundColor] ifTrue:[backgroundColor] ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   693
    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   694
    styleSheet at:#'menuPanel.activeBackgroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   695
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   696
    var := styleSheet colorAt:#'menu.disabledEtchedForegroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   697
    var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledEtchedForegroundColor' ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   698
    styleSheet at:#'menuPanel.disabledEtchedFgColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   699
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   700
    var := styleSheet colorAt:#'menu.disabledForegroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   701
    var isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   702
        var := styleSheet colorAt:#'selection.disabledForegroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   703
        var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledForegroundColor' default:Color darkGray ]
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   704
    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   705
    styleSheet at:#'menuPanel.disabledForegroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   706
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   707
    var := styleSheet colorAt:#'menu.hilightForegroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   708
    var isNil ifTrue:[ var := styleSheet is3D ifTrue:[foregroundColor] ifFalse:[backgroundColor] ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   709
    styleSheet at:#'menuPanel.activeForegroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   710
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   711
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   712
    buttonActiveLevel := styleSheet at:#'menu.buttonActiveLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]).
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   713
    buttonActiveLevel isNil ifTrue:[ buttonActiveLevel := styleSheet at:#'button.activeLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]) ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   714
    styleSheet at:#'menuPanel.buttonActiveLevel' put:buttonActiveLevel.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   715
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   716
    buttonPassiveLevel := styleSheet at:#'menu.buttonPassiveLevel'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   717
    buttonPassiveLevel isNil ifTrue:[ buttonPassiveLevel :=  styleSheet at:#'button.passiveLevel' default:(styleSheet is3D ifTrue:[2] ifFalse:[0])].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   718
    styleSheet at:#'menuPanel.buttonPassiveLevel' put:buttonPassiveLevel.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   719
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   720
    buttonEnteredLevel := styleSheet at:#'menu.buttonEnteredLevel' default:buttonPassiveLevel.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   721
    styleSheet at:#'menuPanel.buttonEnteredLevel' put:buttonEnteredLevel.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   722
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   723
    var := (buttonActiveLevel abs max:(buttonPassiveLevel abs)) max:(buttonEnteredLevel abs).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   724
    styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   725
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   726
    buttonPassiveBackgroundColor := styleSheet at:#'button.backgroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   727
    buttonPassiveBackgroundColor isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   728
        buttonPassiveBackgroundColor := (styleSheet at:'viewBackground') ? backgroundColor
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   729
    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   730
    styleSheet at:#'menuPanel.buttonPassiveBackgroundColor' put:buttonPassiveBackgroundColor.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   731
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   732
    var := styleSheet at:#'button.lightColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   733
    var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) lightened ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   734
    styleSheet at:#'menuPanel.buttonLightColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   735
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   736
    var :=  styleSheet at:#'button.shadowColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   737
    var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) darkened ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   738
    styleSheet at:#'menuPanel.buttonShadowColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   739
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   740
    var := styleSheet colorAt:#'menu.buttonEnteredBackgroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   741
    var isNil ifTrue:[ var := styleSheet colorAt:#'button.enteredBackgroundColor' default:buttonPassiveBackgroundColor ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   742
    styleSheet at:#'menuPanel.buttonEnteredBackgroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   743
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   744
    Item updateStyleCache.
2607
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   745
2754
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   746
    getBitmapOrFile := [:key :fileKey |
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   747
        |var|
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   748
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   749
        var := styleSheet at:key ifAbsent:nil.
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   750
        var isNil ifTrue:[
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   751
            var := styleSheet at:fileKey ifAbsent:nil.
2752
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   752
            var notNil ifTrue:[
2754
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   753
                var := Smalltalk imageFromFileNamed:var forClass:self.
2752
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   754
            ].
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   755
        ].
2754
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   756
        var
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   757
    ].
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   758
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   759
    IconIndicationOn := getBitmapOrFile value:#'menu.iconIndicationOn' value:#'menu.iconIndicationOn.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   760
    IconIndicationOff := getBitmapOrFile value:#'menu.iconIndicationOff' value:#'menu.iconIndicationOff.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   761
    IconDisabledIndicationOn := getBitmapOrFile value:#'menu.iconDisabledIndicationOn' value:#'menu.iconDisabledIndicationOn.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   762
    IconDisabledIndicationOff := getBitmapOrFile value:#'menu.iconDisabledIndicationOff' value:#'menu.iconDisabledIndicationOff.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   763
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   764
    IconRadioOn := getBitmapOrFile value:#'menu.iconRadioOn' value:#'menu.iconRadioOn.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   765
    IconRadioOff := getBitmapOrFile value:#'menu.iconRadioOff' value:#'menu.iconRadioOff.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   766
    IconDisabledRadioOn := getBitmapOrFile value:#'menu.iconDisabledRadioOn' value:#'menu.iconDisabledRadioOn.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   767
    IconDisabledRadioOff := getBitmapOrFile value:#'menu.iconDisabledRadioOff' value:#'menu.iconDisabledRadioOff.bitmapFile'.
2752
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   768
2607
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   769
    "
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   770
     self updateStyleCache
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   771
    "
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   772
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   773
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   774
!MenuPanel class methodsFor:'image registration'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   775
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   776
image:anImage onDevice:aDevice
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   777
"
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   778
Images := nil
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   779
"
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   780
    |deviceImages|
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   781
1156
6fa33dc93509 fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   782
    anImage device == aDevice ifTrue:[
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   783
        ^ anImage
1853
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   784
    ].
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   785
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   786
    Images isNil ifTrue:[ Images := WeakIdentityDictionary new ].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   787
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   788
    (deviceImages := Images at:aDevice ifAbsent:nil) isNil ifTrue:[
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   789
        Images at:aDevice put:(deviceImages := Dictionary new)
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   790
    ].
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   791
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   792
    ^ deviceImages at:anImage ifAbsentPut:[ |image|
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   793
        image := anImage copy onDevice:aDevice.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   794
        image clearMaskedPixels.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   795
        deviceImages at:anImage put:image.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   796
        image
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   797
    ].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   798
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   799
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   800
lightenedImage:anImage onDevice:aDevice
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   801
"
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   802
LigthenedImages := nil
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   803
"
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   804
    |deviceImages image colorMap|
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   805
1853
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   806
    LigthenedImages isNil ifTrue:[ LigthenedImages := WeakIdentityDictionary new ].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   807
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   808
    (deviceImages := LigthenedImages at:aDevice ifAbsent:nil) isNil ifTrue:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   809
        LigthenedImages at:aDevice put:(deviceImages := Dictionary new)
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   810
    ].
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   811
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   812
    (image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   813
        ^ image
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   814
    ].
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   815
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   816
    colorMap := anImage perform:#colorMap ifNotUnderstood:nil.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   817
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   818
    colorMap notNil ifTrue:[
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   819
        image := anImage copy lightened onDevice:aDevice.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   820
        image clearMaskedPixels.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   821
    ] ifFalse:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   822
        image := self image:anImage onDevice:aDevice
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   823
    ].
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   824
    deviceImages at:anImage put:image.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   825
    ^ image
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   826
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   827
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   828
!MenuPanel class methodsFor:'private'!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   829
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   830
subMenu:aSubMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   831
    "create a submenu; can be redifined in derived classes"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   832
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   833
    ^ (self new) menu:aSubMenu.
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   834
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   835
    "Modified: / 8.8.1998 / 02:13:11 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   836
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   837
1808
e8628b502a49 methodCategory change
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   838
!MenuPanel methodsFor:'accepting'!
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   839
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   840
accept
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   841
    "accept current selected item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   842
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   843
    ^ self acceptItem:(self selection) inMenu:self
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   844
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   845
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
   846
accept:anItem 
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
   847
    "this is the topMenu: accept item "
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
   848
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
   849
    |item tgState itemIdx recv panel masterGroup winGrp acceptAction focusView|
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
   850
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   851
    self superMenu notNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   852
        ^ self topMenu accept:anItem
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   853
    ].
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
   854
    prevFocusView ~~ self ifTrue:[
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
   855
        focusView := prevFocusView.
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
   856
    ].
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
   857
    prevFocusView := nil.
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
   858
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
   859
    self openDelayed:nil.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   860
    self scrollActivity stop.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   861
    self selection:nil.
420
ca
parents: 417
diff changeset
   862
ca
parents: 417
diff changeset
   863
    (anItem notNil and:[anItem canAccept]) ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   864
        tgState := anItem toggleIndication.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   865
        panel   := anItem menuPanel.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   866
        itemIdx := panel findFirst:[:el| el == anItem ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   867
        item    := anItem.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   868
        recv    := panel receiver.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   869
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   870
    self doUngrab:true.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   871
510
8f77b9382066 bug fix with redraw
ca
parents: 505
diff changeset
   872
    self isPopUpView ifFalse:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   873
        self do:[:el| el updateIndicators].
3143
645efaba917a bugfix: check for notNil windowGroup
ca
parents: 3142
diff changeset
   874
        (winGrp := self windowGroup) notNil ifTrue:[
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
   875
            winGrp processExposeEvents.
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
   876
        ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   877
    ] ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   878
        self unmap.
2712
8a5f94b10261 late expose event bug fixed
ca
parents: 2696
diff changeset
   879
        self device sync. "/ round trip - all expose events are now received
3143
645efaba917a bugfix: check for notNil windowGroup
ca
parents: 3142
diff changeset
   880
645efaba917a bugfix: check for notNil windowGroup
ca
parents: 3142
diff changeset
   881
        (winGrp := self windowGroup) notNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   882
            "/ give expose event a chance to arrive
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   883
            [shown and:[realized]] whileTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   884
                winGrp processExposeEventsFor:self
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   885
            ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   886
            masterGroup := winGrp previousGroup.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   887
        ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   888
        "/ cg: disabled-not needed - try PopUpList with destroy...
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   889
        "/ self destroy.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   890
        masterGroup notNil ifTrue:[masterGroup processExposeEvents].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   891
    ].
1710
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   892
3144
772766a2e99e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
   893
    acceptAction := [   
772766a2e99e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
   894
                        |winGrp|
772766a2e99e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
   895
3189
a2e61ce4a7cb focus handling
ca
parents: 3187
diff changeset
   896
                        (focusView notNil and:[(winGrp := self windowGroup) notNil]) ifTrue:[
a2e61ce4a7cb focus handling
ca
parents: 3187
diff changeset
   897
                            winGrp focusView:focusView.
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
   898
                        ].
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
   899
                        self accept:item index:itemIdx toggle:tgState receiver:recv.
2826
7294e112f2c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2817
diff changeset
   900
                    ].
2050
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
   901
1710
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   902
    (item notNil 
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   903
    and:[item showBusyCursorWhilePerforming
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   904
    and:[(winGrp := (masterGroup ? (self windowGroup))) notNil]])
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   905
    ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   906
        winGrp withWaitCursorDo:acceptAction
3144
772766a2e99e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
   907
    ] ifFalse:[
772766a2e99e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
   908
        acceptAction value
772766a2e99e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
   909
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   910
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   911
    self isPopUpView ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   912
        self menuAdornmentAt:#item put:item.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   913
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   914
    ^ item.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   915
3144
772766a2e99e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
   916
    "Modified: / 08-11-2006 / 17:14:06 / cg"
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   917
!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   918
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   919
accept:anItem index:anIndex toggle:aState receiver:aReceiver
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   920
    "accept an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   921
3558
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
   922
    |selectorOrBlock argument numArgs isValueModel rec args arg2 
1697
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
   923
     app master fallBack|
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   924
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   925
    anItem isNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   926
        self menuAdornmentAt:#hasPerformed put:true.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   927
      ^ nil
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   928
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   929
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   930
    isValueModel := aReceiver isValueModel.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   931
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   932
    self menuAdornmentAt:#hasPerformed put:isValueModel.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   933
3558
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
   934
    (selectorOrBlock := anItem value) isNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   935
        ^ anIndex
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   936
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   937
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   938
    (argument := anItem argument) isNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   939
        argument := aState ? anItem
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   940
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   941
3558
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
   942
    selectorOrBlock isSymbol ifFalse:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   943
        "/ a valueHolder or block
3558
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
   944
        (selectorOrBlock respondsTo:#valueWithArguments:) ifFalse:[
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
   945
             ^ selectorOrBlock
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
   946
        ].
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
   947
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
   948
        numArgs := selectorOrBlock perform:#numArgs ifNotUnderstood:0.
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   949
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   950
        numArgs == 0 ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   951
            args := nil
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   952
        ] ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   953
            numArgs == 1 ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   954
                args := Array with:argument
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   955
            ] ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   956
                args := Array with:argument with:self
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   957
            ]
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   958
        ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   959
3558
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
   960
        selectorOrBlock valueWithArguments:args.
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   961
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   962
        self menuAdornmentAt:#hasPerformed put:true.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   963
        ^ anIndex
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   964
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   965
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   966
    anItem sendToOriginator ifTrue:[
2473
6ace3a7234b0 care for nil originator
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   967
        rec := self originator.
6ace3a7234b0 care for nil originator
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   968
        rec isNil ifTrue:[
2844
e813c02733ea *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2833
diff changeset
   969
            self error:'no originating widget (no target for message)' mayProceed:true.
2473
6ace3a7234b0 care for nil originator
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   970
        ].
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   971
    ] ifFalse:[
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   972
        rec := aReceiver
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   973
    ].
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   974
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   975
    rec isNil ifTrue:[
3558
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
   976
        ^ selectorOrBlock
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   977
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   978
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   979
    isValueModel ifTrue:[
3558
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
   980
        rec value:selectorOrBlock
465
67a0f3dd503a in case of performing a selector '0' is returned
ca
parents: 464
diff changeset
   981
    ] ifFalse:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   982
        arg2 := self.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   983
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   984
        "/ support for ST80 style applications
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   985
        "/ (expecting the message to go to the application
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   986
        "/  if not understood by the view)
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   987
        "/ These expect the controller to be passed as argument.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   988
        "/ sigh.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   989
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   990
        (rec isView
3558
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
   991
        and:[(rec respondsTo:selectorOrBlock) not
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   992
        and:[(app := rec application) ~~ rec
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   993
        and:[app notNil]]]) ifTrue:[
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   994
            arg2 := rec controller.       "/ the Views controller
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   995
            rec := app.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   996
        ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   997
3558
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
   998
        (numArgs := selectorOrBlock numArgs) == 0 ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   999
            args := nil
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1000
        ] ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1001
            numArgs == 1 ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1002
                args := Array with:argument
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1003
            ] ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1004
                args := Array with:argument with:arg2
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1005
            ]
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1006
        ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1007
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1008
        fallBack := 
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1009
            [
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1010
                "/ mhmh - the receiver did not respond to that message;
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1011
                "/ if there is a master-application, try that one
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1012
                "/ (recursive)
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1013
                master := rec perform:#masterApplication ifNotUnderstood:nil.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1014
                master notNil ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1015
                    rec := master.
3558
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
  1016
                    rec perform:selectorOrBlock withArguments:args ifNotUnderstood:fallBack
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1017
                ] ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1018
                    self 
3558
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
  1019
                        error:'unimplemented (or error in) menu message: ' , selectorOrBlock
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1020
                        mayProceed:true
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1021
                ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1022
            ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1023
3558
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
  1024
        rec perform:selectorOrBlock withArguments:args ifNotUnderstood:fallBack.
420
ca
parents: 417
diff changeset
  1025
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1026
    self menuAdornmentAt:#hasPerformed put:true.
3558
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
  1027
    ^ selectorOrBlock
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1028
1719
ba7ebb56e6fd recursively try masterApps when performing
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  1029
    "Modified: / 19.2.2000 / 11:08:22 / cg"
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1030
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1031
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1032
acceptItem:anItem inMenu:aMenu
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  1033
    |tgState topMenu|
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  1034
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  1035
    topMenu := self topMenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  1036
    topMenu openDelayed:nil.
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1037
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  1038
    (anItem isNil or:[anItem hideMenuOnActivated]) ifTrue:[
2934
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  1039
        topMenu accept:anItem
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1040
    ] ifFalse:[
2934
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  1041
        anItem canAccept ifTrue:[
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  1042
            tgState := anItem toggleIndication.
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  1043
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  1044
            self accept:anItem
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  1045
                  index:(aMenu selectionIndex)
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  1046
                 toggle:tgState 
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  1047
               receiver:(aMenu receiver).
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  1048
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  1049
            aMenu do:[:el| el updateIndicators].
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  1050
            anItem hideMenuOnActivated ifFalse:[
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  1051
                aMenu invalidate
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  1052
            ].
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  1053
        ]
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1054
    ]
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1055
!
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1056
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1057
lastItemAccepted
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1058
    "returns last item selected or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1059
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1060
  ^ self topMenu menuAdornmentAt:#item
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1061
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1062
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1063
lastValueAccepted
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1064
    "returns last value accepted or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1065
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1066
    ^ self lastItemAccepted value
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1067
! !
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1068
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1069
!MenuPanel methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1070
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1071
accessCharacterPositionAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1072
    "get the access character position for a textLabel"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1073
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1074
    ^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1075
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1076
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1077
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1078
    "get the access character position for a textLabel"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1079
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1080
    self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1081
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1082
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1083
accessCharacterPositions
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1084
    "returns a collection of accessCharacterPositions or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1085
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1086
    ^ self collect:[:anItem| anItem accessCharacterPosition ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1087
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1088
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1089
accessCharacterPositions:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1090
    "define accessCharacterPositions for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1091
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1092
    self onEachPerform:#accessCharacterPosition: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1093
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1094
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1095
args
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1096
    "returns a collection of arguments or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1097
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1098
    ^ self collect:[:anItem| anItem argument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1099
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1100
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1101
args:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1102
    "define arguments for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1103
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1104
    self onEachPerform:#argument: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1105
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1106
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1107
argsAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1108
    "gets the argument of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1109
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1110
    ^ self itemAt:stringOrNumber do:[:el| el argument ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1111
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1112
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1113
argsAt:stringOrNumber put:anArgument
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1114
    "sets the argument of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1115
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1116
    self itemAt:stringOrNumber do:[:el| el argument:anArgument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1117
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1118
3332
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1119
doAccessCharacterTranslation
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1120
    "true if &-chars in a label are to be treated as accessCharacter indicators.
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1121
     Can be set to false to leave labels unchanged"
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1122
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1123
    ^ doAccessCharacterTranslation ? true
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1124
!
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1125
3328
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1126
doAccessCharacterTranslation:aBoolean
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1127
    "true if &-chars in a label are to be treated as accessCharacter indicators.
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1128
     Can be set to false to leave labels unchanged"
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1129
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1130
    doAccessCharacterTranslation := aBoolean
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1131
!
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1132
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1133
enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1134
    "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
  1135
     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
  1136
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1137
    ^ enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1138
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1139
    "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
  1140
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1141
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1142
groupSizes
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1143
    "gets collection of group sizes"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1144
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1145
  ^ groupSizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1146
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1147
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1148
groupSizes:aGroupSizes
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1149
    "sets collection of group sizes"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1150
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1151
    aGroupSizes = groupSizes ifFalse:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1152
        groupSizes := aGroupSizes copy.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1153
        self mustRearrange.
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
2731
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1157
hideOnRelease
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1158
    ^ hideOnRelease
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1159
!
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1160
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1161
hideOnRelease:something
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1162
    hideOnRelease := something.
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1163
!
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1164
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1165
labelAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1166
    "gets the label of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1167
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1168
  ^ self itemAt:stringOrNumber do:[:el| el label ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1169
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1170
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1171
labelAt:stringOrNumber put:aLabel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1172
    "sets the label of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1173
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1174
    self itemAt:stringOrNumber do:[:el| el label:aLabel ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1175
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1176
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1177
labels
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1178
    "returns a collection of labels's or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1179
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1180
    ^ self collect:[:anItem| anItem label ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1181
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1182
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1183
labels:labels
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1184
    "define labels for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1185
2118
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  1186
    |size|
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  1187
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1188
    self disabledRedrawDo:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1189
        self removeAll.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1190
        size := labels size.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1191
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1192
        size > 0 ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1193
            items := OrderedCollection new:size.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1194
            labels do:[:aLabel| items add:(Item in:self label:aLabel) ]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1195
        ]
2118
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  1196
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1197
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1198
1999
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1199
menuPerformer:anObject 
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1200
    "set the menu-receiver. Thats the one who gets the messages ( both from myself and
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1201
     from all submenus no specific receiver is defined )."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1202
1999
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1203
    ^ self receiver:anObject
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1204
!
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1205
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1206
nameKeyAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1207
    "gets the nameKey of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1208
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1209
    ^ self itemAt:stringOrNumber do:[:el| el nameKey ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1210
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1211
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1212
nameKeyAt:stringOrNumber put:aNameKey
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1213
    "sets the nameKey of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1214
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1215
    self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1216
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1217
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1218
nameKeys
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1219
    "returns a collection of nameKeyss or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1220
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1221
    ^ self collect:[:anItem| anItem nameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1222
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1223
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1224
nameKeys:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1225
    "define nameKeys for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1226
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1227
    self onEachPerform:#nameKey: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1228
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1229
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1230
numberOfItems
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1231
    "gets number of items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1232
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1233
    ^ items size
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1234
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1235
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1236
originator
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1237
    originator notNil ifTrue:[^ originator].
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1238
    superMenu notNil ifTrue:[
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1239
        ^ superMenu originator
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1240
    ].
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1241
    ^ nil
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1242
!
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1243
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1244
receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1245
    "get the menu-receiver. Thats the one who gets the messages ( both from myself and
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1246
     from all submenus no specific receiver is defined )."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1247
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1248
    (receiver isNil and:[superMenu notNil]) ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1249
        ^ superMenu receiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1250
    ].
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1251
  ^ receiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1252
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1253
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1254
receiver:anObject 
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1255
    "set the menu-receiver. Thats the one who gets the messages ( both from myself and
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1256
     from all submenus no specific receiver is defined )."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1257
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1258
    receiver := anObject
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1259
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1260
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1261
shortcutKeyAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1262
    "gets the shortCutKey of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1263
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1264
    ^ self itemAt:stringOrNumber do:[:el| el shortcutKey ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1265
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1266
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1267
shortcutKeyAt:stringOrNumber put:aKey
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1268
    "sets the shortCutKey of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1269
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1270
    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
  1271
!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1272
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1273
shortcutKeys
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1274
    "returns a collection of shortcutKeys or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1275
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1276
    ^ self collect:[:anItem| anItem shortcutKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1277
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1278
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1279
shortcutKeys:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1280
    "define shortcutKeys for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1281
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1282
    self onEachPerform:#shortcutKey: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1283
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1284
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1285
valueAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1286
    "gets value of an item; a block, valueHolder, ..."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1287
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1288
    ^ self itemAt:stringOrNumber do:[:el| el value ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1289
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1290
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1291
valueAt:stringOrNumber put:someThing
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1292
    "sets value of an item; a block, valueHolder, ..."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1293
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1294
    self itemAt:stringOrNumber do:[:el| el value:someThing ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1295
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1296
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1297
values:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1298
    "define values for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1299
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1300
    self onEachPerform:#value: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1301
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1302
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1303
!MenuPanel methodsFor:'accessing-behavior'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1304
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1305
disableAll
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1306
    "disable all items; not the menu in case of enabled"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1307
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1308
    self do:[:anItem| anItem enabled:false]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1309
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1310
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1311
disableAll:collectionOfIndicesOrNames
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1312
    "disable an collection of items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1313
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1314
    collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1315
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1316
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1317
enableAll
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1318
    "enable all items; not the menu in case of disabled"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1319
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1320
    self do:[:anItem| anItem enabled:true]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1321
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1322
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1323
enableAll:collectionOfIndicesOrNames
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1324
    "enable an collection of items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1325
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1326
    collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1327
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1328
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1329
enabled
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1330
    "returns enabled state"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1331
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1332
    ^ enabled
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1333
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1334
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1335
enabled:aState
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1336
    "change enabled state of menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1337
545
d01d14358b07 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 524
diff changeset
  1338
    |state|
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1339
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1340
    state := aState ? true.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1341
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  1342
    enabled ~~ state ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1343
        enabled := state.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1344
        self invalidate.
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1345
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1346
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1347
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1348
enabledAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1349
    "gets the enabled state of an item or false"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1350
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1351
  ^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1352
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1353
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1354
enabledAt:stringOrNumber put:aState
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1355
    "sets the enabled state of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1356
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1357
    self itemAt:stringOrNumber do:[:el| el enabled:aState ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1358
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1359
2731
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1360
exclusivePointer:aBoolean
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1361
    "Do nothing here. Compatibility with PopUpListController"
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1362
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1363
    ^ self
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1364
!
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1365
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1366
isEnabled:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1367
    "gets the enabled state of an item or false"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1368
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1369
    ^ self enabledAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1370
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1371
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1372
!MenuPanel methodsFor:'accessing-channels'!
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1373
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1374
enableChannel:aValueHolder
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1375
    "set my enableChannel"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1376
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1377
    enableChannel notNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1378
        enableChannel removeDependent:self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1379
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1380
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1381
    (enableChannel := aValueHolder) notNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1382
        enableChannel addDependent:self.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1383
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1384
    self enabled:(enableChannel value).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1385
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1386
3222
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1387
menuChannel
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1388
    ^ self menuHolder
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1389
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1390
    "Created: / 27-03-2007 / 08:38:31 / cg"
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1391
!
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1392
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1393
menuHolder:aValueHolder
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1394
    "set my menuHolder"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1395
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1396
    menuHolder notNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1397
        menuHolder removeDependent:self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1398
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1399
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1400
    (menuHolder := aValueHolder) notNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1401
        menuHolder addDependent:self.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1402
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1403
    self menu:(menuHolder value)
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1404
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1405
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1406
!MenuPanel methodsFor:'accessing-color & font'!
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1407
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1408
activeBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1409
    "get the background drawing color used to highlight selection"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1410
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1411
    ^ styleSheet colorAt:#'menuPanel.activeBackgroundColor'
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1412
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1413
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1414
activeForegroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1415
    "get the foreground color used to highlight selections"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1416
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1417
    ^ styleSheet colorAt:#'menuPanel.activeForegroundColor'
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1418
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1419
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1420
backgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1421
    "return the background color"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1422
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  1423
    ^ super viewBackground
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1424
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1425
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1426
backgroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1427
    "set the background drawing color. You should not use this method;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1428
     instead, leave the value as defined in the styleSheet."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1429
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1430
    self backgroundColor ~~ aColor ifTrue:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  1431
        super viewBackground:aColor.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  1432
        self invalidate "/ RepairNow:true
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1433
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1434
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1435
    "Modified: / 6.6.1998 / 19:50:06 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1436
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1437
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1438
buttonActiveBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1439
    "get the background drawing color used to highlight button selection"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1440
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1441
    ^ styleSheet colorAt:#'button.activeBackgroundColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1442
                 default:(self viewBackground)
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1443
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1444
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1445
buttonActiveForegroundColor
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1446
    "get the foreground drawing color used to highlight button selection"
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1447
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1448
    ^ styleSheet colorAt:#'button.activeForegroundColor'
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1449
                 default:(self foregroundColor)
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1450
!
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1451
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1452
buttonEdgeStyle
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1453
    "get the button edge style"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1454
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1455
    ^ styleSheet at:#'button.edgeStyle'
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1456
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1457
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1458
buttonEnteredBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1459
    "get the background drawing color used to highlight entered button items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1460
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1461
    ^ styleSheet colorAt:#'menuPanel.buttonEnteredBackgroundColor'
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1462
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1463
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1464
buttonEnteredLevel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1465
    "get the 3D-level used to highlight entered button items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1466
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1467
    ^ styleSheet at:#'menuPanel.buttonEnteredLevel'
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1468
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1469
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1470
buttonHalfLightColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1471
    "get the background drawing color used to half light button frame"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1472
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1473
    ^ styleSheet colorAt:#'button.halfLightColor'
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1474
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1475
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1476
buttonHalfShadowColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1477
    "get the background drawing color used to half shadow button frame"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1478
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1479
    ^ styleSheet colorAt:#'button.halfShadowColor'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1480
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1481
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1482
buttonLightColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1483
    "get the background drawing color used to light button frame"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1484
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1485
    ^ styleSheet colorAt:#'menuPanel.buttonLightColor'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1486
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1487
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1488
buttonPassiveBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1489
    "get the background drawing color used for button"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1490
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1491
    ^ styleSheet colorAt:#'menuPanel.buttonPassiveBackgroundColor'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1492
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1493
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1494
buttonShadowColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1495
    "get the background drawing color used to shadow button frame"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1496
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1497
    ^ styleSheet colorAt:#'menuPanel.buttonShadowColor'
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1498
!
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1499
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1500
disabledEtchedForegroundColor
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1501
    "return the color used for etching disabled items.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1502
     If nil, no 3D effect is drawn."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1503
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1504
    ^ styleSheet colorAt:#'menuPanel.disabledEtchedFgColor'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1505
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1506
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1507
disabledForegroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1508
    "return the foreground color used by disabled items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1509
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1510
    ^ styleSheet colorAt:#'menuPanel.disabledForegroundColor'
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1511
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1512
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1513
enteredBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1514
    "return the background color for entered items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1515
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1516
    ^ styleSheet colorAt:#'menu.enteredBackgroundColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1517
                 default:(self backgroundColor)
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1518
!
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1519
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1520
enteredForegroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1521
    "return the foreground color for entered items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1522
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1523
    ^ styleSheet colorAt:#'menu.enteredForegroundColor' default:fgColor
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1524
!
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1525
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1526
font:aFont
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1527
    "set the font"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1528
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1529
    (aFont isNil or:[aFont = font]) ifTrue:[ ^ self ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1530
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1531
    super font:aFont.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1532
    self do:[:anItem| anItem fontChanged ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1533
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1534
    (shown and:[superMenu notNil]) ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1535
        self extent:(self preferredExtent)
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1536
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1537
    self mustRearrange.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1538
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1539
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1540
foregroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1541
    "return the passive foreground color"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1542
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1543
    ^ fgColor
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1544
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1545
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1546
foregroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1547
    "set the foregroundColor drawing color. You should not use this method;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1548
     instead leave the value as defined in the styleSheet."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1549
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1550
    aColor ~= fgColor ifTrue:[
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1551
        fgColor := aColor onDevice:device.
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  1552
        self invalidate
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1553
    ].
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  1554
!
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  1555
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1556
maxAbsoluteButtonLevel
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1557
    "returns the maximum absolute button level; used to compute the preferred
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1558
     extent of a button"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1559
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1560
    ^ styleSheet at:#'menuPanel.maxAbsoluteButtonLevel'
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1561
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1562
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1563
selectionFrameBrightColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1564
    "get the selection frame bright color"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1565
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1566
    ^ Color white
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1567
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1568
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1569
selectionFrameDarkColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1570
    "get the selection frame dark color"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1571
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1572
    ^ Color black
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1573
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1574
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1575
setFont:aFont
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  1576
    "set the font if the argument is nonNil; 
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  1577
     Return nil, if the font was unchanged; otherwise, return the old font"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  1578
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1579
    |currentFont|
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1580
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1581
    (aFont notNil and:[aFont ~= font]) ifTrue:[
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  1582
        currentFont := font.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  1583
        super font:aFont.
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1584
    ].
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1585
    ^ currentFont
2761
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  1586
!
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  1587
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  1588
viewBackground:aColor
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  1589
    super viewBackground:aColor
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1590
! !
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1591
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1592
!MenuPanel methodsFor:'accessing-dimensions'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1593
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1594
height
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1595
    "default height"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1596
3334
50374a42b3d9 use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents: 3332
diff changeset
  1597
    (self hasExplicitExtent not) ifTrue:[
3421
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  1598
        ^ self preferredHeight
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1599
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1600
    ^ super height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1601
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1602
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1603
maxExtent
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1604
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1605
    device notNil ifTrue:[
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1606
        ^ device usableExtent - 2.
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1607
    ].
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1608
    superMenu notNil ifTrue:[
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1609
        ^ superMenu maxExtent
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1610
    ].
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1611
    "don't know, assume there is no maxExtent"
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1612
    self error:'don''t know maxExtent'.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1613
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1614
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1615
preferredExtent
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1616
    "compute and returns my preferred extent"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1617
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1618
    |maxExtent usedExtent|
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1619
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1620
    preferredExtent notNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1621
        ^ preferredExtent
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1622
    ].
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1623
    usedExtent := self preferredExtentOfItems.
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1624
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1625
    superView isNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1626
        "/ is standalone
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  1627
        preferredWidth notNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1628
            usedExtent x < preferredWidth ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1629
                usedExtent := preferredWidth @ usedExtent y.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1630
            ]
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1631
        ]
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1632
    ].
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1633
        
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1634
    maxExtent := self maxExtent.
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1635
    maxExtent notNil ifTrue:[
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1636
        usedExtent := usedExtent min:maxExtent.
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1637
    ].
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1638
    ^ usedExtent
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1639
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1640
    "Modified: / 10.10.2001 / 14:57:25 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1641
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1642
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1643
preferredExtentOfItems
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1644
    "compute and returns my preferred extent including all items
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1645
        !!!!!! changes have influence on method #rearrangeItems !!!!!!"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1646
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1647
    |hasMenu shCtKey extent showAcc sck
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1648
     x            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1649
     y            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1650
     size         "{ Class:SmallInteger }"
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1651
     buttonInsetX2 "{ Class:SmallInteger }"
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1652
     buttonInsetY2 "{ Class:SmallInteger }"
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1653
     labelInsetX  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1654
     labelInsetY  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1655
     itemMargin   "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1656
     groupDividerSize "{ Class:SmallInteger }"
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  1657
    |
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1658
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1659
    (size := items size) == 0 ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1660
        self isViewWrapper ifTrue:[ ^ subViews first extent ].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  1661
        ^ 32 @ 32
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1662
    ].
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1663
    stringOffsetX := nil.
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1664
    buttonInsetX2 := 2 * buttonInsetX.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1665
    buttonInsetY2 := 2 * buttonInsetY.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1666
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1667
    self isPopUpView ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1668
        labelInsetX := labelInsetY := 2 * (self enteredLevel abs).
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1669
    ] ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1670
        labelInsetX := labelInsetY := 0.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1671
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1672
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1673
    x := 0.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1674
    y := 0.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1675
    groupDividerSize := self groupDividerSize.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1676
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1677
    self verticalLayout ifFalse:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1678
        items keysAndValuesDo:[:key :el| |eX eY|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1679
            extent := el preferredExtent.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1680
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1681
            "/ check for visibility (extent x ~~ 0)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1682
            (eX := extent x) ~~ 0 ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1683
                eY := extent y.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1684
                
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1685
                el isButton ifTrue:[
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1686
                    eX := eX + buttonInsetX2.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1687
                    eY := eY + buttonInsetY2.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1688
                ] ifFalse:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1689
                    eX := eX + labelInsetX.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1690
                    eY := eY + labelInsetY.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1691
                ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1692
                key ~~ size ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1693
                    (self hasGroupDividerAt:key) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1694
                        x := x + groupDividerSize
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1695
                    ] ifFalse:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  1696
                        el needsItemSpaceWhenDrawing ifTrue:[
1723
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  1697
                            x := x + itemSpace
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  1698
                        ]
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
                ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1701
                x := eX + x.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1702
                y := eY max:y.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1703
            ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1704
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1705
    ] ifTrue:[
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1706
        hasMenu := false.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1707
        shCtKey := 0.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1708
        showAcc := MenuView showAcceleratorKeys == true.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1709
        y := x.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1710
        x := 0.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1711
        itemMargin := 2 * self itemMargin.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1712
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1713
        items keysAndValuesDo:[:key :el| |eX eY|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1714
            extent := el preferredExtent.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1715
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1716
            "/ check for visibility (extent x ~~ 0)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1717
            (eX := extent x) ~~ 0 ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1718
                eY := extent y.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1719
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1720
                el isButton ifTrue:[
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1721
                    eX := eX + buttonInsetX2.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1722
                    eY := eY + buttonInsetY2.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1723
                ] ifFalse:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1724
                    eX := eX + labelInsetX.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1725
                    eY := eY + labelInsetY.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1726
                ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1727
                hasMenu ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1728
                    hasMenu := el hasSubmenu
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1729
                ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1730
                (showAcc and:[(sck := el shortcutKeyAsString) notNil]) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1731
                    shCtKey := shCtKey max:(sck widthOn:self)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1732
                ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1733
                key ~~ size ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1734
                    (self hasGroupDividerAt:key) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1735
                        y := y + groupDividerSize
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1736
                    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1737
                ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1738
                y := eY + y.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1739
                x := eX max:x.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1740
            ].
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1741
        ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1742
        x := x + itemMargin.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1743
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1744
        (hasMenu or:[shCtKey ~~ 0]) ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1745
            shortKeyInset := x + Item labelRightOffset.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1746
            x := shortKeyInset + shCtKey + self subMenuIndicationWidth.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1747
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1748
            (shCtKey ~~ 0 and:[hasMenu]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1749
                x := x + self shortcutKeyOffset. 
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1750
            ]
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1751
        ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1752
"/ to have a small inset
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1753
        y := y + 1.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1754
"/        x := x + 1.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1755
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1756
    x := x + margin + margin.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1757
    y := y + margin + margin.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1758
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  1759
    ^ x @ y
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1760
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1761
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1762
preferredWidth:aWidthOrNil
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1763
    "used for example by combo box to setup the preferred width for the popup menu.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1764
     If nil (default), the width is computed from the contained items.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1765
     If not nil, the width is the maximum from the contained items and the required width."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1766
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1767
    preferredWidth := aWidthOrNil.
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1768
!
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1769
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1770
shortKeyInset
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1771
    "left inset of shortcutKey"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1772
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1773
    ^ shortKeyInset
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1774
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1775
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1776
stringOffsetXfor:anItem
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1777
    "return the x offset for a MenuItem where to draw the text
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1778
    "
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1779
    |label w|
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1780
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1781
    anItem isButton ifTrue:[ ^ 0 ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1782
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1783
    stringOffsetX isNil ifTrue:[
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1784
        stringOffsetX := 0.
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1785
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1786
        (self isPopUpView and:[self verticalLayout]) ifTrue:[
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1787
            self do:[:el|
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1788
                el isVisible ifTrue:[
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1789
                    (    (label := el indicatorForm) notNil
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1790
                     or:[(label := el choiceForm) notNil]
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1791
                    ) ifTrue:[
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1792
                        stringOffsetX := stringOffsetX max:(label width + 2).
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1793
                    ] ifFalse:[
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1794
                        label := el displayLabel.
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1795
                        label class == LabelAndIcon ifTrue:[
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1796
                            stringOffsetX := stringOffsetX max:(label xOfString).
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1797
                        ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1798
                    ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1799
                ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1800
            ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1801
        ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1802
    ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1803
    w := 0.
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1804
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1805
    (    (label := anItem indicatorForm) notNil
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1806
     or:[(label := anItem choiceForm) notNil]
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1807
    ) ifTrue:[
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1808
        w := label width + 2.
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1809
    ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1810
    stringOffsetX == 0 ifTrue:[
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1811
        ^ w
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1812
    ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1813
    w == 0 ifTrue:[
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1814
        label := anItem displayLabel.
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1815
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1816
        label class == LabelAndIcon ifTrue:[
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1817
            ^ stringOffsetX - label xOfString
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1818
        ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1819
    ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1820
    ^ stringOffsetX.
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1821
!
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1822
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1823
subMenuIndicationWidth
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1824
    ^ self rightArrow width
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1825
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1826
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1827
!MenuPanel methodsFor:'accessing-interactors'!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1828
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1829
iconIndicationDisabledOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1830
    ^ self registerImageOnDevice:(self class iconIndicationDisabledOff)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1831
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1832
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1833
iconIndicationDisabledOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1834
    ^ self registerImageOnDevice:(self class iconIndicationDisabledOn)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1835
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1836
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1837
iconIndicationOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1838
    ^ self registerImageOnDevice:(self class iconIndicationOff)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1839
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1840
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1841
iconIndicationOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1842
    ^ self registerImageOnDevice:(self class iconIndicationOn)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1843
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1844
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1845
iconRadioGroupDisabledOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1846
    ^ self registerImageOnDevice:(self class iconRadioGroupDisabledOff)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1847
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1848
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1849
iconRadioGroupDisabledOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1850
    ^ self registerImageOnDevice:(self class iconRadioGroupDisabledOn)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1851
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1852
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  1853
iconRadioGroupEnteredOff
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  1854
    ^ self registerImageOnDevice:(self class iconRadioGroupEnteredOff)
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  1855
!
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  1856
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  1857
iconRadioGroupEnteredOn
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  1858
    ^ self registerImageOnDevice:(self class iconRadioGroupEnteredOn)
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  1859
!
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  1860
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1861
iconRadioGroupOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1862
    ^ self registerImageOnDevice:(self class iconRadioGroupOff)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1863
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1864
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1865
iconRadioGroupOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1866
    ^ self registerImageOnDevice:(self class iconRadioGroupOn)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1867
! !
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1868
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1869
!MenuPanel methodsFor:'accessing-items'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1870
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1871
itemAt:stringOrNumber do:aOneArgBlock
2505
56607624d05a Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents: 2504
diff changeset
  1872
    "evaluate the block for an item and return the result from the block. In case that  
56607624d05a Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents: 2504
diff changeset
  1873
     the item does not exist nil is returned"
56607624d05a Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents: 2504
diff changeset
  1874
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1875
    ^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1876
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1877
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1878
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1879
    "evaluate teh block for an item and return the result from the block. In case that  
2505
56607624d05a Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents: 2504
diff changeset
  1880
     the item does not exists the result of the exception block is returned (no arguments)"
56607624d05a Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents: 2504
diff changeset
  1881
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1882
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1883
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1884
    item := self itemAt:stringOrNumber.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1885
    item notNil ifTrue:[ ^ aOneArgBlock value:item ].
2505
56607624d05a Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents: 2504
diff changeset
  1886
    ^ exceptionBlock value
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1887
!
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1888
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1889
itemAtIndex:anIndex
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1890
    "returns item at an index or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1891
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1892
    ^ 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
  1893
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1894
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1895
items
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1896
    "returns list of items or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1897
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1898
    ^ items
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1899
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1900
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1901
!MenuPanel methodsFor:'accessing-look'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1902
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1903
buttonActiveLevel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1904
    "get the buttons active level"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1905
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1906
    ^ styleSheet at:#'menuPanel.buttonActiveLevel'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1907
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1908
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1909
buttonPassiveLevel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1910
    "get the buttons passive level"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1911
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1912
    ^ styleSheet at:#'menuPanel.buttonPassiveLevel'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1913
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1914
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  1915
centerItems
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  1916
    ^ centerItems ? false
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  1917
!
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  1918
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  1919
centerItems:aBoolean
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  1920
    centerItems := aBoolean
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  1921
!
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  1922
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1923
fitFirstPanel
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1924
    "gets true if the first panel in the menu hierarchy must be fit 
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1925
     to the extent of its superView
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1926
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1927
     NOT SUPPORTED"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1928
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1929
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1930
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1931
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1932
fitFirstPanel:aState
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1933
    "sets true if the first panel in the menu hierarchy must be fit 
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1934
     to the extent of its superView
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1935
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1936
     NOT SUPPORTED"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1937
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1938
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1939
level:anInt
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  1940
    anInt ~~ level ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  1941
	super level:anInt.
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  1942
	self mustRearrange
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  1943
    ]
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1944
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1945
    "Modified: / 15.11.2001 / 17:42:07 / cg"
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1946
!
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1947
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1948
rightArrow
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  1949
    rightArrow isNil ifTrue:[
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  1950
        device isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1951
            ^ SelectionInListView rightArrowFormOn:Display
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1952
        ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1953
        rightArrow := SelectionInListView rightArrowFormOn:device
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1954
    ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1955
    ^ rightArrow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1956
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1957
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1958
rightArrowShadow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1959
    ^ rightArrowShadow
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1960
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1961
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1962
showGroupDivider
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1963
    "get the enabled flag for showing groupDiveders"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1964
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1965
    ^ showGroupDivider
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1966
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1967
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1968
showGroupDivider:aState
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1969
    "set the enabled flag for showing groupDiveders"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1970
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1971
    showGroupDivider ~~ aState ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1972
        showGroupDivider := aState.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1973
        self mustRearrange.
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1974
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1975
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1976
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1977
showSeparatingLines
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1978
    "gets true if drawing of separating lines is enabled."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1979
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1980
    ^ showSeparatingLines
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1981
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1982
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1983
showSeparatingLines:aState
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1984
    "turn on/off drawing of separating lines."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1985
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1986
    aState ~~ showSeparatingLines ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1987
        showSeparatingLines := aState.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1988
        self mustRearrange
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1989
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1990
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1991
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1992
verticalLayout
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1993
    "get the layout: vertical( true ) or horizontal( false )"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1994
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  1995
    verticalLayout notNil ifTrue:[ ^ verticalLayout ].
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1996
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1997
    superMenu notNil ifTrue:[ verticalLayout := true ]
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1998
                    ifFalse:[ verticalLayout := self isPopUpView ].
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  1999
    ^ verticalLayout
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2000
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2001
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2002
verticalLayout:aState
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2003
    "set the layout: vertical( true ) or horizontal( false )"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2004
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2005
    aState ~~ verticalLayout ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2006
        verticalLayout isNil ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2007
            verticalLayout := aState
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2008
        ] ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2009
            verticalLayout := aState.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2010
            self mustRearrange.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2011
        ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2012
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2013
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2014
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2015
!MenuPanel methodsFor:'accessing-style'!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2016
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2017
buttonInsetX
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2018
    "returns the verical button space"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2019
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  2020
    ^ buttonInsetX
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2021
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2022
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2023
buttonInsetY
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2024
    "returns the verical button space"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2025
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  2026
    ^ buttonInsetY
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2027
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2028
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2029
drawMenuIndicatorSeparatorLine
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2030
^ true.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2031
    ^ styleSheet at:#'menu.drawMenuIndicatorSeparatorLine'  default:false
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2032
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2033
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2034
enteredLevel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2035
    "returns the enter-level for an unselected item moved through"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2036
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2037
    ^ styleSheet at:#'menu.enteredLevel'  default:0
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2038
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2039
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2040
groupDividerSize
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2041
    "returns the width of a group divider"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2042
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2043
    ^ styleSheet at:#'menu.groupDividerSize' default:6
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2044
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2045
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2046
itemMargin
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2047
    "returns the margin of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2048
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2049
    ^ styleSheet at:#'menu.itemMargin' default:0
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2050
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2051
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2052
itemSpace
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2053
    "returns the additional space for an item in a (vertical) panel"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2054
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  2055
    ^ itemSpace
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2056
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2057
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2058
menuIndicatorVerticalPosition
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2059
    "#center, #top or #bottom"
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2060
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2061
    ^ #center
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2062
    "/ ^ styleSheet at:#'menu.menuIndicatorVerticalPosition' default:#bottom
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2063
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2064
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2065
selectionFollowsMouse
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2066
    "returns true if the selection follows the mouse"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2067
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2068
    ^ styleSheet at:#'menu.selectionFollowsMouse' default:false
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2069
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2070
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2071
shortcutKeyOffset
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2072
    "returns the offset for a shortcutKey"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2073
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2074
    ^ 5
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2075
! !
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2076
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  2077
!MenuPanel methodsFor:'accessing-submenu'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2078
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2079
subMenuAt:stringOrNumber
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2080
    "gets the current submenu of an item; if the submenu is nil, the
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2081
     submenu is generated if specified otherwise nil is returned."
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2082
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2083
    |submenu|
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2084
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2085
    
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2086
    self itemAt:stringOrNumber do:[:anItem|
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2087
        submenu := anItem currentSubmenu.
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2088
        submenu isNil ifTrue:[
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2089
            submenu := anItem setupSubmenu
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2090
        ].
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2091
    ].
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2092
    ^ submenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2093
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2094
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2095
subMenuAt:stringOrNumber put:aSubMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2096
    "sets the submenu of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2097
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2098
    self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2099
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2100
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2101
subMenuShown
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2102
    "return the currently visible submenu - or nil if there is none"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2103
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2104
    |item submenu|
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2105
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2106
    item := self selection.
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2107
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2108
    item notNil ifTrue:[
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2109
        submenu := item currentSubmenu.
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2110
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2111
        (submenu notNil and:[submenu shown]) ifTrue:[
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2112
            ^ submenu
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2113
        ].
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2114
    ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2115
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2116
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2117
2504
0ce78a73aacf method category rename
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
  2118
!MenuPanel methodsFor:'activation & deactivation'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2119
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  2120
closeMenus
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2121
    "close all menus without accepting"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2122
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  2123
    self topMenu accept:nil.
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  2124
!
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  2125
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2126
hide
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2127
    "hide the view, leave its modal event loop"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2128
2407
d8cdc13f677b checkin from browser
penk
parents: 2374
diff changeset
  2129
    "/ TODO: replace with LeaveSignal raise.
d8cdc13f677b checkin from browser
penk
parents: 2374
diff changeset
  2130
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2131
    self selection:nil.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2132
    self unmap.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2133
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2134
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2135
show
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2136
    "realize the view at its last position;
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2137
     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
  2138
     (unless the menu has already performed its action, by sending an appropriate message
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2139
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2140
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2141
    ^ self showAt:(self origin) resizing:true
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2142
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2143
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2144
showAt:aPoint
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2145
    "realize the view at aPoint.
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2146
     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
  2147
     (unless the menu has already performed its action, by sending an appropriate message
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2148
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2149
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2150
  ^ self showAt:aPoint resizing:true
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2151
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2152
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2153
showAt:aPoint resizing:aBoolean
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2154
    "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
  2155
     or if I have already performed.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2156
     Return the items value, otherwise.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2157
     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
  2158
     menu (i.e. the view or controller), which will perform the action
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2159
     if a non-nil is returned."
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2160
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2161
    self rearrangeItemsIfItemVisibilityChanged.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2162
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2163
    aBoolean ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2164
        self fixSize.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2165
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2166
    self origin:aPoint.
1459
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  2167
"/    self makeFullyVisible.   -- done in realize
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2168
    self openModal:[true]. "realize     "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2169
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2170
    "/ if I have already performed,
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2171
    "/ return nil - to avoid items triggering twice.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2172
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2173
    (self topMenu menuAdornmentAt:#hasPerformed) == true ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2174
        ^ nil
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2175
    ].
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2176
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2177
    ^ self lastValueAccepted
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2178
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2179
    "Modified: / 15.9.1998 / 12:50:23 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2180
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2181
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2182
showAtPointer
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2183
    "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
  2184
     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
  2185
     (unless the menu has already performed its action, by sending an appropriate message
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2186
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2187
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2188
  ^ self showAt:(device pointerPosition) resizing:true
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2189
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2190
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2191
showCenteredIn:aView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2192
    "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
  2193
     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
  2194
     (unless the menu has already performed its action, by sending an appropriate message
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2195
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2196
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2197
    |top|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2198
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2199
    top := aView topView.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2200
    top raise.
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2201
    ^ 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
  2202
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2203
    "Modified: / 15.9.1998 / 12:45:50 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2204
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2205
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2206
startUp
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2207
    "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
  2208
     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
  2209
     (unless the menu has already performed its action, by sending an appropriate message
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2210
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2211
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2212
    ^ self showAtPointer
897
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2213
!
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2214
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2215
startUpAt:aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2216
    "realize the menu at aPoint
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2217
     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
  2218
     (unless the menu has already performed its action, by sending an appropriate message
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2219
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2220
897
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2221
    ^ self showAt:aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2222
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2223
    "Created: / 21.5.1998 / 14:15:57 / cg"
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2224
!
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2225
2332
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2226
startUpFor:originatingWidget
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2227
    "realize the menu at the current pointer position
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2228
     return the value of the selectedItem or nil, of none was selected
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2229
     (unless the menu has already performed its action, by sending an appropriate message
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2230
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2231
2332
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2232
    originator := originatingWidget.
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2233
    ^ self startUp
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2234
!
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2235
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2236
startUpOrNil
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2237
    "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
  2238
     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
  2239
     (unless the menu has already performed its action, by sending an appropriate message
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2240
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2241
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2242
    ^ self showAtPointer
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2243
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2244
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2245
!MenuPanel methodsFor:'adding & removing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2246
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2247
createAtIndex:anIndexOrNil
1800
600f247a2846 comment
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  2248
    "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
  2249
     is added to the end. If the index is not valid nil is returned;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2250
     otherwise the new created item is returned."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2251
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2252
    |max item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2253
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2254
    max := (items size) + 1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2255
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2256
    anIndexOrNil notNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2257
        (anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2258
            ^ nil
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2259
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2260
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2261
    items isNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2262
        items := OrderedCollection new
1151
199863d6a463 items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents: 1137
diff changeset
  2263
    ] ifFalse:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2264
        items := items asOrderedCollection
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2265
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2266
    item := Item in:self.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2267
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2268
    (anIndexOrNil isNil or:[anIndexOrNil == max]) ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2269
        items add:item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2270
    ] ifFalse:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2271
        items add:item beforeIndex:anIndexOrNil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2272
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2273
    ^ item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2274
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2275
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2276
remove:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2277
    "remove the first item which is assigned to stringOrNumber;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2278
     if found, remove and return it"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2279
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2280
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2281
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2282
    (item := self itemAt:stringOrNumber) notNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2283
        items remove:item.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2284
        item  destroy.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2285
        items isEmpty ifTrue:[items := nil].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2286
        self mustRearrange.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2287
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2288
  ^ item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2289
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2290
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2291
removeAll
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2292
    "remove all items and submenus"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2293
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2294
    self disabledRedrawDo:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2295
        self selection:nil.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2296
        groupSizes := nil.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2297
        items notNil ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2298
            items copy do:[:el| el destroy ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2299
        ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2300
        items := nil
2050
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
  2301
    ].
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
  2302
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
  2303
    "Modified: / 15.11.2001 / 17:02:51 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2304
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2305
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2306
!MenuPanel methodsFor:'change & update'!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2307
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2308
update:something with:aParameter from:changedObject
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2309
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2310
    changedObject == menuHolder    ifTrue:[^ self menu:(menuHolder value)].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2311
    changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2312
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2313
    super update:something with:aParameter from:changedObject
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2314
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2315
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2316
!MenuPanel methodsFor:'converting'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2317
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2318
asMenu
3222
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2319
    "convert contents to a menu"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2320
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2321
    |menu|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2322
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2323
    menu := Menu new.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2324
    menu groupSizes:groupSizes.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2325
    self do:[:anItem| menu addItem:(anItem asMenuItem) ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  2326
    ^ menu
3222
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2327
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2328
    "Modified: / 27-03-2007 / 08:39:48 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2329
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2330
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2331
fromSpec:aMenuSpec
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2332
    "build from spec"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2333
3222
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2334
    self menu:(Menu decodeFromLiteralArray:aMenuSpec)
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2335
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2336
    "Modified: / 27-03-2007 / 08:42:43 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2337
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2338
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2339
menu:aMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2340
    "convert to Menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2341
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2342
    self disabledRedrawDo:[
2232
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2343
        |menu newItems menuReceiver|
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2344
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2345
        self removeAll.
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2346
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2347
        (menu := aMenu) notNil ifTrue:[
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2348
            (aMenu isCollection) ifTrue:[
3222
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2349
                menu := Menu decodeFromLiteralArray:aMenu.
2232
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2350
            ] ifFalse:[
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2351
                menuReceiver := menu receiver.        
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2352
                menuReceiver notNil ifTrue:[
2793
2c524ca057f6 *** empty log message ***
penk
parents: 2777
diff changeset
  2353
                    self receiver:menuReceiver.
2232
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2354
                ]
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2355
            ].
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2356
            (newItems := menu menuItems) size > 0 ifTrue:[
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2357
                items := newItems collect:[:ni | 
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2358
                                |i|
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2359
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2360
                                i:= Item in:self.
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2361
                                i menuItem:ni.
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2362
                                i.
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2363
                            ].
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2364
            ].
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2365
            self groupSizes:(menu groupSizes).
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2366
        ]
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2367
    ]
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2368
3222
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2369
    "Modified: / 27-03-2007 / 08:42:28 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2370
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2371
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2372
!MenuPanel methodsFor:'dependents access'!
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2373
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2374
addDependencies
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2375
    "add all dependencies"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2376
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2377
    self do:[:anItem| anItem addDependencies ].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2378
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2379
    menuHolder    notNil ifTrue:[menuHolder    addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2380
    enableChannel notNil ifTrue:[enableChannel addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2381
!
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2382
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2383
removeDependencies
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2384
    "remove all dependencies"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2385
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2386
    self do:[:anItem| anItem removeDependencies ].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2387
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2388
    menuHolder    notNil ifTrue:[menuHolder    removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2389
    enableChannel notNil ifTrue:[enableChannel removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2390
! !
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2391
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2392
!MenuPanel methodsFor:'drawing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2393
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2394
disabledRedrawDo:aBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2395
    "evaluate a block without redrawing within the block; after processing
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2396
     of the block a redraw might be performed"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2397
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2398
    |state|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2399
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2400
    state := mustRearrange.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2401
    mustRearrange := true.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2402
    aBlock value.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2403
    mustRearrange := state.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2404
    self mustRearrange
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2405
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2406
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2407
drawButtonEdgesFor:anItem level:aLevel
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2408
    |layout|
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2409
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2410
    aLevel ~~ 0 ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2411
        layout := anItem layout.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2412
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2413
        styleSheet is3D ifFalse:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2414
            self displayRectangle:layout.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2415
        ] ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2416
            self drawEdgesForX:(layout left)
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2417
                             y:(layout top)
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2418
                         width:(layout width)
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2419
                        height:(layout height)
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2420
                         level:aLevel 
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2421
                        shadow:(self buttonShadowColor) 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2422
                         light:(self buttonLightColor)
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2423
                    halfShadow:(self buttonHalfShadowColor) 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2424
                     halfLight:(self buttonHalfLightColor)
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2425
                         style:(self buttonEdgeStyle)
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2426
        ]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2427
    ]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2428
!
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2429
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2430
drawFocusForItem:anItem
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2431
    |lytItem|
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2432
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2433
    lytItem := anItem layout.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2434
    self paint:(Color black).
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2435
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2436
    self displayDottedRectangleX:(lytItem left)
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2437
                               y:(lytItem top)
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2438
                           width:(lytItem width)
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2439
                          height:(lytItem height).
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2440
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2441
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2442
drawItemsX:x y:y width:w height:h
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2443
    "redraw items and groups in a damage"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2444
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2445
    |isVertical item layout prevClip
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2446
     x1             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2447
     x2             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2448
     y1             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2449
     y2             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2450
     start          "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2451
     stop           "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2452
     size           "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2453
     groupDivInset  "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2454
    |
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2455
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2456
    size := items size.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2457
    isVertical := self verticalLayout.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2458
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2459
    isVertical ifTrue:[
2064
0e0d1fe431fb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  2460
        start := items findFirst:[:el| |l| l := el layout. l notNil and:[l bottom > y]].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2461
        start == 0 ifTrue:[ ^ self ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2462
        y1 := y + h.
2064
0e0d1fe431fb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  2463
        stop := items findFirst:[:el| |l| l := el layout. l notNil and:[l top > y1] ] 
0e0d1fe431fb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  2464
                     startingAt:(start + 1).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2465
    ] ifFalse:[
2064
0e0d1fe431fb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  2466
        start := items findFirst:[:el| |l| l := el layout. l notNil and:[l right > x ]].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2467
        start == 0 ifTrue:[ ^ self ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2468
        x1  := x + w.
2064
0e0d1fe431fb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  2469
        stop := items findFirst:[:el| |l| l := el layout.l notNil and:[l left > x1]] 
0e0d1fe431fb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  2470
                     startingAt:(start + 1).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2471
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2472
    stop  == 0 ifTrue:[stop := size] ifFalse:[stop := stop - 1].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2473
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2474
    (groupSizes size ~~ 0 and:[showGroupDivider]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2475
        groupDivInset := self groupDividerSize // 2.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2476
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2477
        groupDivInset ~~ 0 ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2478
            (start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2479
                start := start - 1
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2480
            ]
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2481
        ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2482
    ] ifFalse:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2483
        groupDivInset := 0
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2484
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2485
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2486
    prevClip := clipRect.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2487
    self clippingRectangle:(Rectangle left:x top:y width:w height:h).
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2488
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2489
    start to:stop do:[:i|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2490
        item := items at:i.
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  2491
        item draw.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2492
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2493
        (groupDivInset ~~ 0 and:[i ~~ size and:[self hasGroupDividerAt:i]]) ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2494
            layout := item layout.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2495
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2496
            isVertical ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2497
                x1 := layout left.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2498
                x2 := layout right.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2499
                y1 := layout bottom + groupDivInset.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2500
                y2 := y1.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2501
            ] ifFalse:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2502
                y1 := layout top.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2503
                y2 := layout bottom.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2504
                x1 := layout right + groupDivInset.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2505
                x2 := x1.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2506
            ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2507
            self paint:shadowColor.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2508
            self displayLineFromX:x1 y:y1 toX:x2 y:y2.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2509
            self paint:lightColor.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2510
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2511
            isVertical ifTrue:[y1 := y1 + 1. y2 := y1 ]
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2512
                      ifFalse:[x1 := x1 + 1. x2 := x1 ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2513
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2514
            self displayLineFromX:x1 y:y1 toX:x2 y:y2
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2515
        ].
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2516
        selection == item ifTrue:[
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2517
            self focusComesByTab ifTrue:[
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2518
                self drawFocusForItem:item.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2519
            ].
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2520
        ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2521
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2522
    self clippingRectangle:prevClip.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2523
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2524
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2525
drawLabelEdgeFor:anItem selected:isSelected
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2526
    |level layout|
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2527
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2528
    isSelected ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2529
        level := styleSheet at:#'menu.hilightLevel' default:0.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2530
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2531
        anItem == enteredItem ifTrue:[ level := self enteredLevel ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2532
                             ifFalse:[ level := 0 ]
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2533
    ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2534
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2535
    level ~~ 0 ifTrue:[
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2536
        layout := anItem layout.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2537
1691
8e1a9d7a298e bugfix in drawLableEdge...
ca
parents: 1690
diff changeset
  2538
        self drawEdgesForX:(layout left)
8e1a9d7a298e bugfix in drawLableEdge...
ca
parents: 1690
diff changeset
  2539
                         y:(layout top)
8e1a9d7a298e bugfix in drawLableEdge...
ca
parents: 1690
diff changeset
  2540
                     width:(layout width)
8e1a9d7a298e bugfix in drawLableEdge...
ca
parents: 1690
diff changeset
  2541
                    height:(layout height)
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2542
                     level:level
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2543
    ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2544
!
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2545
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2546
drawScrollerAt:aDirection bounds:bounds
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2547
    "draw a scroller"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2548
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2549
    |scrolling icon level x y w h|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2550
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2551
    x := bounds left.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2552
    y := bounds top.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2553
    w := bounds width.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2554
    h := bounds height.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2555
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  2556
    scrolling := self scrollActivity.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2557
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2558
    (scrolling activeMenu == self and:[scrolling direction == aDirection]) ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2559
        level := -2
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2560
    ] ifFalse:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2561
        level := 1
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2562
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2563
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2564
    level ~~ 0 ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2565
        self drawEdgesForX:x y:y width:w height:h level:level.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2566
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2567
    icon := scrolling iconAt:aDirection on:self.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2568
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2569
    icon displayOn:self x:(x + (w - icon width  // 2))
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2570
                        y:(y + (h - icon height // 2)).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2571
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2572
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2573
invalidateItem:anItem repairNow:aBool
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2574
    "an item changed; invalidate the items layout"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2575
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2576
    |layout|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2577
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2578
    (mustRearrange not and:[shown]) ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2579
        layout := anItem layout.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2580
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2581
        (layout bottom > margin and:[layout top < (height - margin)]) ifTrue:[
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2582
            self invalidate:(layout "insetBy:-1") repairNow:aBool
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2583
        ]
1728
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2584
    ].
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2585
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2586
    "Modified: / 29.2.2000 / 11:28:59 / cg"
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  2587
!
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  2588
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2589
mustRearrange
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2590
    "force rearrange (i.e. set the rearrange flag)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2591
2080
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2592
    mustRearrange ifFalse:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  2593
        mustRearrange := true.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  2594
        self invalidate "/ RepairNow:true
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2595
    ]
590
3177528b5f95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  2596
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  2597
    "Modified: / 6.6.1998 / 19:51:07 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2598
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2599
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2600
rearrangeGroups
3126
8dca3b01f1db new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3125
diff changeset
  2601
    "implements the groupIdentifier #right/#conditionalRight in a horizontal menu"
8dca3b01f1db new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3125
diff changeset
  2602
8dca3b01f1db new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3125
diff changeset
  2603
    <resource: #style (#'menuPanel.ignoreConditionalStartGroupRight')>
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2604
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2605
    |layout point
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2606
     dltX  "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2607
     start "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2608
    |
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2609
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2610
    (self isPopUpView or:[self verticalLayout]) ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2611
        ^ self
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2612
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2613
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2614
    layout := items last layout.
3246
c9e0e6fe80a4 changed #rearrangeGroups
Claus Gittinger <cg@exept.de>
parents: 3242
diff changeset
  2615
    layout notNil ifTrue:[
c9e0e6fe80a4 changed #rearrangeGroups
Claus Gittinger <cg@exept.de>
parents: 3242
diff changeset
  2616
        (dltX := width - margin - layout right) <= 0 ifTrue:[
c9e0e6fe80a4 changed #rearrangeGroups
Claus Gittinger <cg@exept.de>
parents: 3242
diff changeset
  2617
            ^ self  "/ no free space
c9e0e6fe80a4 changed #rearrangeGroups
Claus Gittinger <cg@exept.de>
parents: 3242
diff changeset
  2618
        ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2619
    ].
3125
25a0bdbe879a startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents: 3122
diff changeset
  2620
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  2621
    "/ The behavior of #conditionalRight is controlled by the styleSheet.
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  2622
    "/ If menuPanel.ignoreConditionalStartGroupRight is true, it is ignored.
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  2623
    "/ otherwise, it is treated like #right.
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  2624
    "/ This allows for groups to be specified as #right under motif, but
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  2625
    "/ non-right under win32 (as is used woth the help-menus).
3148
6b74db598eae conditionalRight revisited
Claus Gittinger <cg@exept.de>
parents: 3147
diff changeset
  2626
    (StyleSheet at:#'menuPanel.ignoreConditionalStartGroupRight' ifAbsent:false) ifTrue:[
6b74db598eae conditionalRight revisited
Claus Gittinger <cg@exept.de>
parents: 3147
diff changeset
  2627
        start := items findFirst:[:anItem| anItem startGroup == #right ].
6b74db598eae conditionalRight revisited
Claus Gittinger <cg@exept.de>
parents: 3147
diff changeset
  2628
    ] ifFalse:[
6b74db598eae conditionalRight revisited
Claus Gittinger <cg@exept.de>
parents: 3147
diff changeset
  2629
        start := items findFirst:[:anItem| anItem startGroup == #right or:[ anItem startGroup == #conditionalRight ] ].
3126
8dca3b01f1db new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3125
diff changeset
  2630
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2631
    start == 0 ifTrue:[
3125
25a0bdbe879a startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents: 3122
diff changeset
  2632
        ^ self  "/ no right-group item detected
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2633
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2634
    point := dltX @ 0.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2635
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2636
    "/ move items layout to right
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2637
    items from:start do:[:anItem|
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2638
        anItem isVisible ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2639
            anItem layout moveBy:point.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2640
        ]
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2641
    ].
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2642
    self updateEnteredItem.
3125
25a0bdbe879a startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents: 3122
diff changeset
  2643
3246
c9e0e6fe80a4 changed #rearrangeGroups
Claus Gittinger <cg@exept.de>
parents: 3242
diff changeset
  2644
    "Modified: / 10-10-2007 / 00:29:34 / cg"
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2645
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2646
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2647
rearrangeItems
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2648
    "recompute the layout of each item
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2649
        !!!!!! changes have influence on method #preferredExtentOfItems !!!!!!"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2650
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2651
    |isVertical extent isPopUpMenu
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2652
     x            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2653
     y            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2654
     x0           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2655
     y0           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2656
     x1           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2657
     y1           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2658
     size         "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2659
     insetX       "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2660
     insetY       "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2661
     labelInsetX  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2662
     labelInsetY  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2663
     itemMargin   "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2664
     groupDividerSize "{ Class:SmallInteger }"
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2665
    |
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2666
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2667
    (mustRearrange and:[(size := items size) ~~ 0]) ifFalse:[
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2668
        mustRearrange := false.
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  2669
        ^ self
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2670
    ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2671
2080
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2672
"/  DON'T SET THIS!!
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2673
"/  item layout:  below of first item -> item invalidate 
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2674
"/                                    -> menuPanel invalidateItem:repairDamage: 
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2675
"/                                    -> invalidate:rapairDamage:
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2676
"/                                    -> redrawX:y:width:height:
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2677
"/                                    tries to get uninitialized layout from second item.
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2678
"/ This happens in a modal debugger!!
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2679
"/    mustRearrange := false.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2680
    isVertical       := self verticalLayout.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2681
    groupDividerSize := self groupDividerSize.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2682
    isPopUpMenu      := self isPopUpView.
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2683
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2684
    isPopUpMenu ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2685
        labelInsetX := labelInsetY := self enteredLevel abs.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2686
    ] ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2687
        labelInsetX := labelInsetY := 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2688
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2689
3334
50374a42b3d9 use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents: 3332
diff changeset
  2690
    (isPopUpMenu or:[self hasExplicitExtent not]) ifTrue:[ 
50374a42b3d9 use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents: 3332
diff changeset
  2691
        |saveExtent maxExtent extentToSet|
50374a42b3d9 use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents: 3332
diff changeset
  2692
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  2693
        extent := self preferredExtent.
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  2694
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  2695
        isPopUpMenu ifTrue:[
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  2696
            maxExtent := self maxExtent.
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  2697
            maxExtent notNil ifTrue:[
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  2698
                extentToSet := isVertical ifTrue:[extent x @ (extent y min:(maxExtent y))] 
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  2699
                                          ifFalse:[(extent x min:(maxExtent x)) @ extent y].
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  2700
            ].
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  2701
        ] ifFalse:[
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  2702
            extent := extentToSet := isVertical ifTrue:[extent x @ 1.0] ifFalse:[1.0 @ extent y].
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2703
        ].
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  2704
        self extent:extentToSet.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2705
    ] ifFalse:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2706
        extent := self computeExtent
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2707
    ].
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2708
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  2709
    x := y := margin.
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  2710
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2711
    isVertical ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2712
        y0 := margin.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2713
        y1 := extent y - margin.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2714
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2715
        items keysAndValuesDo:[:anIndex :el|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2716
            el isVisible ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2717
                el layout:(Rectangle left:x top:y0 right:x bottom:y1)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2718
            ] ifTrue:[
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2719
                el isButton ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2720
                    insetX := buttonInsetX.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2721
                    insetY := buttonInsetY.
2062
31ba9af25394 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2061
diff changeset
  2722
                ] ifFalse:[            
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2723
                    insetX := labelInsetX.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2724
                    insetY := labelInsetY.
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2725
                ].
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2726
                x0 := x  + insetX.
3421
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  2727
                x1 := x0 + (el preferredWidth).
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2728
                el layout:(Rectangle left:x0 top:(y0 + insetY) right:x1 bottom:(y1 - insetY)).
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2729
                x := x1 + insetX.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2730
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2731
                size ~~ anIndex ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2732
                    (self hasGroupDividerAt:anIndex) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2733
                        x := x + groupDividerSize
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2734
                    ] ifFalse:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  2735
                        el needsItemSpaceWhenDrawing ifTrue:[
1723
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  2736
                            x := x + itemSpace
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  2737
                        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2738
                    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2739
                ]
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2740
            ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2741
        ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2742
    ] ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2743
        itemMargin := self itemMargin.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2744
        x0 := margin.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2745
        x1 := extent x - margin - itemMargin.  "/ -1
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2746
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2747
        items keysAndValuesDo:[:anIndex :el|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2748
            el isVisible ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2749
                el layout:(Rectangle left:x0 top:y right:x1 bottom:y)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2750
            ] ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2751
                el isButton ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2752
                    insetX := buttonInsetX.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2753
                    insetY := buttonInsetY.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2754
                ] ifFalse:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2755
                    insetX := labelInsetX.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2756
                    insetY := labelInsetY.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2757
                ].
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2758
                y0 := y  + insetY.
3421
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  2759
                y1 := y0 + el preferredHeight.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2760
                el layout:(Rectangle left:(x0 + insetX + itemMargin) top:y0 right:(x1 - insetX) bottom:y1).
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2761
                y := y1 + insetY.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2762
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2763
                size ~~ anIndex ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2764
                    (self hasGroupDividerAt:anIndex) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2765
                        y := y + groupDividerSize
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2766
                    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2767
                ]
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2768
            ]
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2769
        ]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2770
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2771
    self rearrangeGroups.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  2772
    selection notNil ifTrue:[self makeItemVisible:selection].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2773
    mustRearrange := false.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  2774
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  2775
    "Modified: / 13.11.2001 / 20:17:21 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2776
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2777
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2778
rearrangeItemsIfItemVisibilityChanged
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2779
    "check for items which can change its visibility;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2780
     if at least one item exists, rearrange all items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2781
1464
3070de4c8b88 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
  2782
    items isNil ifTrue:[^ self].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2783
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2784
    items do:[:item |
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2785
        item canChangeVisibility ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2786
            mustRearrange := true.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2787
            self rearrangeItems.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2788
            ^ self
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2789
        ].
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2790
    ]
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2791
!
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2792
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2793
redrawX:x y:y width:w height:h
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2794
    "redraw a damage"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2795
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2796
    |y0 y1 x0 x1 prvBound mustDraw nxtBound|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2797
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2798
    (shown and:[w ~~ 0]) ifFalse:[^ self].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2799
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2800
    mustRearrange ifTrue:[
3334
50374a42b3d9 use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents: 3332
diff changeset
  2801
        self isPopUpView ifFalse:[ self explicitExtent:true].
1387
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2802
        self rearrangeItems.
2569
bfe9e33b545e not ifTrue -> ifFalse
Claus Gittinger <cg@exept.de>
parents: 2550
diff changeset
  2803
        self invalidate.
bfe9e33b545e not ifTrue -> ifFalse
Claus Gittinger <cg@exept.de>
parents: 2550
diff changeset
  2804
        ^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2805
    ].
2888
095d9fb3e846 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2884
diff changeset
  2806
    "/ self paint:(self viewBackground).
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2807
    self clearRectangleX:x y:y width:w height:h.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2808
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2809
    items size == 0 ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2810
        ^ self
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2811
    ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2812
    y0 := y.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2813
    y1 := y + h.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2814
    x0 := x.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2815
    x1 := x + w.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2816
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2817
    "Draw the scroll handles - especially for Popup-Lists"
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2818
    
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2819
    self hasScrollers ifTrue:[
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2820
        (self hasScrollerAt:#PREV) ifTrue:[
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2821
            prvBound := self scrollerBoundsAt:#PREV.
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2822
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2823
            self verticalLayout ifTrue:[
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2824
                (mustDraw := (prvBound bottom > y)) ifTrue:[
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2825
                    y0 := prvBound bottom.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2826
                ].
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2827
            ] ifFalse:[
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2828
                (mustDraw := (prvBound right > x)) ifTrue:[
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2829
                    x0 := prvBound right.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2830
                ].
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2831
            ].
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2832
            mustDraw ifTrue:[
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2833
                self drawScrollerAt:#PREV bounds:prvBound.
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2834
            ].
1387
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2835
        ].
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2836
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2837
        (self hasScrollerAt:#NEXT) ifTrue:[
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2838
            nxtBound := self scrollerBoundsAt:#NEXT.
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2839
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2840
            self verticalLayout ifTrue:[
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2841
                (mustDraw := (nxtBound top < y1)) ifTrue:[
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2842
                    y1 := nxtBound top.
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2843
                ]
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2844
            ] ifFalse:[
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2845
                (mustDraw := (nxtBound left < x1)) ifTrue:[
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2846
                    x1 := nxtBound left.
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2847
                ]
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2848
            ].
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2849
            mustDraw ifTrue:[
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2850
                self drawScrollerAt:#NEXT bounds:nxtBound.
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2851
            ].
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2852
        ].
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2853
    ].
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2854
    self menuAdornmentAt:#lastDrawnScrollerNextBounds put:nxtBound.
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2855
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2856
    (y1 > y0 and:[x1 > x0]) ifTrue:[
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2857
        self drawItemsX:x0 y:y0 width:(x1 - x0) height:(y1 - y0)
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2858
    ].
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2859
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2860
    "Modified: / 15.11.2001 / 20:57:32 / cg"
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2861
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2862
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2863
updateEnteredItem
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2864
    |mousePoint|
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2865
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2866
    mousePoint  := device translatePoint:(device pointerPosition)
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2867
                           fromView:nil
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2868
                             toView:self.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2869
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2870
    (self containsPoint:mousePoint) ifTrue:[ 
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2871
        enteredItem := self itemAtPoint:mousePoint 
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2872
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2873
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2874
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2875
!MenuPanel methodsFor:'enumerting & searching'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2876
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2877
collect:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2878
    "evaluate the argument, aOneArgBlock for every item in the menuPanel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2879
     and return a collection of the results"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2880
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2881
    items notNil ifTrue:[^ items collect:aOneArgBlock ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  2882
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2883
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2884
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2885
do:aOneArgBlock
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2886
    "evaluate the argument, aOneArgBlock for every item in the menuPanel."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2887
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2888
    items notNil ifTrue:[ items do:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2889
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2890
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2891
findFirst:aOneArgBlock
3206
48a66f672af3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3203
diff changeset
  2892
    "find the index of the first item, for which evaluation of the argument, aOneArgBlock
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2893
     returns true; return its index or 0 if none detected."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2894
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2895
    items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ].
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2896
    ^ 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2897
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2898
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2899
findLast:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2900
    "find the last item, for which evaluation of the argument, aOneArgBlock
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2901
     returns true; return its index or 0 if none detected."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2902
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2903
    items notNil ifTrue:[ ^ items findLast:aOneArgBlock ].
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2904
    ^ 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2905
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2906
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2907
firstItemSelectable
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2908
    "returns the first item which is selectable or nil
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2909
    "
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2910
    items size > 0 ifTrue:[
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2911
        ^ items detect:[:anItem| anItem canSelect ] ifNone:nil
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2912
    ].
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2913
    ^ nil
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2914
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2915
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2916
indexOf:something
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2917
    "returns index of an item assigned to an index, nameKey, textLabel or value if symbol.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2918
     If no item match 0 is returned. No range checks are performed on a number argument"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2919
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2920
    |i v|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2921
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2922
    something isNumber ifTrue:[ ^ something ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2923
    something isNil    ifTrue:[ ^ 0 ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2924
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2925
    i := self findFirst:[:el | (el nameKey = something) or: [el = something]].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2926
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2927
    i ~~ 0 ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2928
        ^ i
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2929
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2930
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2931
    something isSymbol ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2932
        i := self findFirst:[:el|
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2933
                                v := el value.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2934
                                v isSymbol and:[v == something]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2935
                            ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2936
        i ~~ 0 ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2937
            ^ i
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2938
        ]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2939
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2940
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2941
    (something respondsTo:#string) ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2942
        v := something string.
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2943
      ^ self findFirst:[:el | el textLabel = v].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2944
    ].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2945
    ^ 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2946
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2947
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2948
indexOfItem:anItem
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2949
    "returns the index of the item or 0"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2950
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2951
    ^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0]
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2952
!
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2953
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2954
keysAndValuesDo:aTwoArgBlock
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2955
    "evaluate the argument, aTwoArgBlock for every item in the menuPanel."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2956
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2957
    items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2958
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2959
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2960
!MenuPanel methodsFor:'event handling'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2961
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2962
buttonMotion:state x:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2963
    "open or close the corresponding submenu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2964
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  2965
    |menue motionPoint translatedPoint sensor|
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2966
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  2967
    self scrollActivity isActive ifTrue:[
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2968
        ^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2969
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2970
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2971
    sensor := self sensor.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2972
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2973
    (sensor isNil or:[sensor hasButtonMotionEventFor:nil]) ifTrue:[
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2974
        ^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2975
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2976
    menue := self detectGrabMenu.
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2977
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  2978
    motionPoint := x@y.
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  2979
    translatedPoint := menue translateGrabPoint:motionPoint.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  2980
    menue handleButtonMotion:state atPoint:translatedPoint.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2981
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2982
    hideOnRelease := true.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2983
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2984
    (self isPopUpView or:[sensor anyButtonPressed]) ifTrue:[
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2985
        ^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2986
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2987
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2988
    (selection notNil and:[selection visibleSubmenu isNil]) ifTrue:[
3321
2f495adadca5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3301
diff changeset
  2989
        "/ selection on grabView without a submenu (Button ...); check whether moving out
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2990
        (self containsPoint:motionPoint) ifFalse:[
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2991
            ^ self accept:nil
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2992
        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2993
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2994
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  2995
    "Modified: / 13.11.2001 / 20:21:49 / cg"
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2996
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2997
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2998
buttonPress:button x:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2999
    "any button pressed; open or close the corresponding submenus"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3000
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3001
    |menu point|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3002
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3003
    hideOnRelease := true.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3004
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3005
    self scrollActivity stop.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3006
    point := x@y.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3007
    menu  := self detectMenuAtGrabPoint:point.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3008
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3009
    menu isNil ifTrue:[
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  3010
        self accept:nil
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3011
    ] ifFalse:[
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3012
        point := menu translateGrabPoint:point.
3383
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  3013
        menu handleButtonPress:button atPoint:point.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3014
    ]
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3015
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3016
    "Modified: / 13.11.2001 / 14:12:32 / cg"
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3017
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3018
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3019
buttonRelease:button x:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3020
    "button release action; accept selection and close all views"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3021
2679
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  3022
    |topMenu dstMenu item srcPoint dstPoint subm hideMenuAndPerformAction 
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  3023
     releaseTime menuMapTime|
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  3024
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  3025
    topMenu := self topMenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  3026
    topMenu openDelayed:nil.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3027
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3028
    self scrollActivity stop ifTrue:[
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3029
        ^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3030
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3031
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3032
    dstMenu := topMenu activeMenu.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3033
2679
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  3034
    hideMenuAndPerformAction := dstMenu selection notNil or:[dstMenu isPopUpView not].
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  3035
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  3036
    hideMenuAndPerformAction ifFalse:[
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  3037
        hideOnRelease ifTrue:[
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  3038
            releaseTime := windowGroup lastEvent timeStamp.
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  3039
            menuMapTime := dstMenu mapTime ? releaseTime.
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  3040
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  3041
            hideMenuAndPerformAction := (releaseTime millisecondDeltaFrom:menuMapTime)
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3042
                                        > (PopUpMenu maxClickTimeToStayOpen).
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3043
        ].
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3044
    ].
2679
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  3045
    hideMenuAndPerformAction ifTrue:[
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3046
        srcPoint := x@y.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3047
        
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3048
        (     (dstMenu := self detectMenuAtGrabPoint:srcPoint) notNil
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3049
         and:[(item    := dstMenu selection) notNil]
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3050
        ) ifTrue:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3051
            item visibleSubmenu notNil ifTrue:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3052
                dstMenu selection:nil.
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3053
                (selection isNil and:[self isPopUpView not]) ifTrue:[
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3054
                    self accept:nil.
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3055
                ].
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3056
                ^ self
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3057
            ].
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3058
            subm := item currentSubmenu.
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3059
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3060
            subm notNil ifTrue:[
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3061
                subm shown ifTrue:[^ self].
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3062
                "/ test whether any action is assigned to the menu
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3063
                "/ if not ignorre accept
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3064
                item hasDelayedMenu ifFalse:[^ self].
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3065
                "/ handle action defined for the delayed menu
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3066
            ].
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3067
            dstPoint := dstMenu translateGrabPoint:srcPoint.
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3068
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3069
            (dstMenu itemAtPoint:dstPoint) == dstMenu selection ifFalse:[
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3070
                item := nil
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3071
            ].
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3072
            topMenu acceptItem:item inMenu:dstMenu.
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3073
            ^ self
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3074
        ].
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3075
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3076
        (selection notNil and:[dstMenu == self]) ifTrue:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3077
            selection visibleSubmenu notNil ifTrue:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3078
                ^ self
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3079
            ]
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3080
        ].
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3081
        self accept:nil.
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
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3084
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3085
handleSizeChanged:how
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3086
    "used to handle the scrollers and groups in a none popUpView
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3087
    "
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3088
    |layouts damage isVertical scrollBound|
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3089
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3090
    (mustRearrange or:[items size == 0 or:[self isPopUpView]]) ifTrue:[
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3091
        ^ self
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3092
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3093
    mustRearrange := true.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3094
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3095
    shown ifFalse:[
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3096
        ^ self
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3097
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3098
    layouts := OrderedCollection new.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3099
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3100
    items do:[:el| |layout|
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3101
        (layout := el layout) isNil ifTrue:[
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3102
            self invalidate.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3103
            ^ self.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3104
        ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3105
        layouts add:layout.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3106
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3107
    isVertical  := self verticalLayout.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3108
    scrollBound := self scrollerBoundsAt:#NEXT.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3109
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3110
    self rearrangeItems.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3111
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3112
    items keysAndValuesDo:[:i :el| |newLyt oldLyt|
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3113
        damage isNil ifTrue:[
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3114
            newLyt := el layout.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3115
            oldLyt := layouts at:i ifAbsent:newLyt.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3116
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3117
            newLyt ~= oldLyt ifTrue:[ |x y start|
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3118
                start := 0.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3119
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3120
                i > 1 ifTrue:[
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3121
                    isVertical ifTrue:[
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3122
                        x := 0.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3123
                        y := start := (oldLyt top min:(newLyt top)) min:(height - scrollBound height).
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3124
                    ] ifFalse:[
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3125
                        y := 0.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3126
                        x := start := (oldLyt left min:(newLyt left)) min:(width - scrollBound width).
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3127
                    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3128
                ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3129
                start <= 20 ifTrue:[
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3130
                    self invalidate.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3131
                    ^ self
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3132
                ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3133
                damage := Rectangle left:x top:y extent:(self extent).
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3134
            ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3135
        ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3136
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3137
    damage isNil ifTrue:[
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3138
        damage := scrollBound.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3139
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3140
    scrollBound := self menuAdornmentAt:#lastDrawnScrollerNextBounds.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3141
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3142
    scrollBound notNil ifTrue:[
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3143
        damage := damage merge:scrollBound
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3144
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3145
    self invalidate:damage.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3146
!
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3147
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3148
keyPress:key x:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3149
    "any key is pressed"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3150
2869
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3151
    <resource: #keyboard (#Escape
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3152
                          #Tab #FocusNext #FocusPrevious
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3153
                          #CursorLeft #CursorRight )>
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3154
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3155
    |menu menusSuperMenu sensor|
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3156
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3157
    sensor := self sensor.
3158
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3158
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3159
"/    sensor anyButtonPressed ifTrue:[
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3160
"/        ^ self  "/ ignored while any button is pressed
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3161
"/    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3162
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3163
    self scrollActivity isActive ifTrue:[
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3164
        key ~~ #Escape ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3165
            ^ self
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3166
        ].
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3167
        self scrollActivity stop
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3168
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3169
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3170
       (key == #Tab 
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3171
    or:[key == #FocusNext
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3172
    or:[key == #FocusPrevious]]) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3173
        self accept:nil.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3174
        ^ super keyPress:key x:x y:y
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3175
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3176
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3177
    menu := self detectGrabMenu.
2869
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3178
    menusSuperMenu := menu superMenu.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3179
3394
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  3180
    (key == #Escape) ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3181
        "/ must hide the active menu
2869
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3182
        (menusSuperMenu notNil and:[menusSuperMenu ~~ self]) ifTrue:[
1703
e127eff742bb bugfix: request focus
ca
parents: 1701
diff changeset
  3183
            "/ hide active menu but keep the grab
2869
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3184
            menusSuperMenu selection:nil
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3185
        ] ifFalse:[
1703
e127eff742bb bugfix: request focus
ca
parents: 1701
diff changeset
  3186
            "/ hide active menu and ungrab
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3187
            self accept:nil
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3188
        ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3189
        ^ self
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3190
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3191
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3192
    menu isViewWrapper ifFalse:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3193
        sensor compressKeyPressEventsWithKey:key.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3194
        menu handleKeyPress:key.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3195
        ^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3196
    ].
2869
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3197
    menusSuperMenu == self ifFalse:[^ self].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3198
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3199
    "/ allow cursor movement
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3200
    (key == #CursorLeft or:[key == #CursorRight]) ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3201
        (self containsPoint:x@y) ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3202
            self handleKeyPress:key.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3203
        ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3204
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3205
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3206
3415
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3207
mouseWheelMotion:buttonState x:x y:y amount:amount deltaTime:dTime
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3208
    "mousewheel action"
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3209
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3210
    |menu|
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3211
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3212
    menu := self detectGrabMenu.
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3213
    menu isViewWrapper ifTrue:[
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3214
        menu superMenu ~~ self ifTrue:[
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3215
            ^ self.
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3216
        ].
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3217
        menu := self.
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3218
    ].
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3219
    amount > 0 ifTrue:[
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3220
        menu handleCursorKey:#CursorUp.
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3221
    ] ifFalse:[
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3222
        menu handleCursorKey:#CursorDown.
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3223
    ].
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3224
!
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3225
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3226
pointerLeave:state
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3227
    |sensor|
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3228
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3229
    self scrollActivity isActive ifTrue:[^ self].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3230
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3231
    self detectGrabMenu handlePointerLeave:state.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3232
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3233
    (selection isNil or:[self isPopUpView]) ifTrue:[
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3234
        ^ self
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3235
    ].
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3236
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3237
    selection visibleSubmenu notNil ifTrue:[^ self].
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3238
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3239
    windowGroup focusView ~~ self ifTrue:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3240
        self accept:nil
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3241
    ] ifFalse:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3242
        selection isButton ifTrue:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3243
            sensor := self sensor.
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3244
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3245
            sensor isNil ifTrue:[
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3246
                self accept:nil
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3247
            ] ifFalse:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3248
                "/ I'have the focus; if no button pressed, than keep the selection
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3249
                sensor anyButtonPressed ifTrue:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3250
                    self selection:nil
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3251
                ]
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3252
            ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3253
        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3254
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3255
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3256
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3257
sizeChanged:how
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3258
    "redraw #right groups"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3259
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3260
"/    self isPopUpView ifFalse:[
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3261
"/        mustRearrange := true.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3262
"/        self invalidate
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3263
"/    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3264
"/    ^ super sizeChanged:how.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3265
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3266
    self handleSizeChanged:how.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3267
    super sizeChanged:how.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3268
! !
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3269
2503
4f34d55dae21 method category rename
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  3270
!MenuPanel methodsFor:'event handling-processing'!
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3271
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3272
clearImplicitGrab
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3273
    implicitGrabView := lastPointerView := nil.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3274
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3275
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3276
dispatchEvent:ev withFocusOn:focusView delegate:doDelegate
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3277
    "dispatch and handle an event"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3278
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3279
    |view x y p syntheticEvent menu|
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3280
2658
04f9fdd74b8e event handling
Claus Gittinger <cg@exept.de>
parents: 2652
diff changeset
  3281
    ev isDamage ifTrue:[
04f9fdd74b8e event handling
Claus Gittinger <cg@exept.de>
parents: 2652
diff changeset
  3282
        ^ super dispatchEvent:ev withFocusOn:focusView delegate:false.
04f9fdd74b8e event handling
Claus Gittinger <cg@exept.de>
parents: 2652
diff changeset
  3283
    ].
04f9fdd74b8e event handling
Claus Gittinger <cg@exept.de>
parents: 2652
diff changeset
  3284
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3285
    (superMenu isNil and:[ev isButtonPressEvent]) ifTrue:[
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3286
        focusView ~~ self ifTrue:[prevFocusView := focusView].
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3287
    ].
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3288
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3289
    "/ situation: we get a buttonPress, set implicitGrab (for scrollbars etc.)
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3290
    "/ but never get the buttonRelease, since someone else (a popUp) grabbed the
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3291
    "/ pointer in the meantime, and has eaten the release event ... (double-sigh)
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3292
    implicitGrabView notNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3293
        self sensor leftButtonPressed ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3294
            self clearImplicitGrab.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3295
        ].
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3296
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3297
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3298
    ((x := ev x) isNil or:[(y := ev y) isNil]) ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3299
        ^ super dispatchEvent:ev withFocusOn:focusView delegate:false.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3300
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3301
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3302
    implicitGrabView notNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3303
        ev isButtonEvent ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3304
            p := device translatePoint:(x@y) fromView:self toView:implicitGrabView.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3305
            ev view:implicitGrabView.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3306
            ev arguments at:2 put:p x.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3307
            ev arguments at:3 put:p y.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3308
            implicitGrabView dispatchEvent:ev withFocusOn:focusView delegate:false.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3309
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3310
            ev isButtonReleaseEvent ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3311
                self clearImplicitGrab.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3312
            ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3313
            ^ self
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3314
        ]
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3315
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3316
    menu := self detectMenuAtGrabPoint:(x@y).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3317
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3318
    (menu isNil or:[menu isViewWrapper not]) ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3319
        self clearImplicitGrab.
3415
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3320
        ^ super dispatchEvent:ev withFocusOn:focusView delegate:false
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3321
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3322
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3323
    p    := menu translateGrabPoint:(x@y).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3324
    view := self detectViewAtX:(p x) y:(p y) in:menu.
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3325
    p    := device translatePoint:(x@y) fromView:self toView:view.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3326
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3327
    ev isButtonPressEvent ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3328
        (view wantsFocusWithButtonPress) ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3329
            view requestFocus.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3330
        ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3331
        view ~~ self ifTrue:[ "/ can this ever be self ?
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3332
            implicitGrabView := view.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3333
        ]
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3334
    ].
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3335
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3336
    ev isButtonMotionEvent ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3337
        lastPointerView ~~ view ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3338
            "/ must generate enter/leave ... (sigh)
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3339
            lastPointerView notNil ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3340
                "/ XXX: should be fixed
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3341
                syntheticEvent := WindowEvent pointerLeave:0 view:lastPointerView.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3342
                lastPointerView dispatchEvent:syntheticEvent withFocusOn:nil delegate:false.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3343
            ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3344
            view notNil ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3345
                syntheticEvent := WindowEvent pointerEnter:0 x:x y:y view:view.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3346
                view dispatchEvent:syntheticEvent withFocusOn:nil delegate:false.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3347
            ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3348
            lastPointerView := view.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3349
        ].
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3350
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3351
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3352
    ev view:view.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3353
    ev x:p x.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3354
    ev y:p y.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3355
    view dispatchEvent:ev withFocusOn:focusView delegate:false.
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3356
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3357
    "Modified: / 10.10.2001 / 13:54:47 / cg"
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3358
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3359
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3360
handleButtonMotion:state atPoint:motionPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3361
    "open or close the corresponding submenus"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3362
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3363
    |menu item translatedPoint containsPoint direction|
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3364
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3365
    containsPoint := self containsPoint:motionPoint.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3366
    containsPoint ifTrue:[ 
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3367
        item := self itemAtPoint:motionPoint 
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3368
    ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3369
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3370
    "no aotoscroll, if the mouse pointer is inside the scroll button"
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3371
    direction := self scrollerDirectionAtPoint:motionPoint.
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3372
    direction notNil ifTrue:[
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3373
        self pointerEntersItem:nil.
3295
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  3374
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  3375
        self sensor anyButtonPressed ifTrue:[
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  3376
            self scrollActivity startIfRequiredAt:direction on:self comesViaButtonPress:false.
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  3377
        ].
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3378
        ^ self
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3379
    ].
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3380
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3381
    self pointerEntersItem:item.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3382
1910
119f91172b70 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1902
diff changeset
  3383
    (state == 0 or:[self sensor anyButtonPressed not]) ifTrue:[
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3384
        (     self selectionFollowsMouse
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3385
         and:[self topMenu focusComesByTab not]
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3386
        ) ifTrue:[
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3387
            self isPopUpView ifTrue:[
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3388
                item isNil ifTrue:[
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3389
                    superMenu notNil ifTrue:[
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3390
                        translatedPoint := self translateMenuPoint:motionPoint toMenu:superMenu.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3391
                        superMenu handleButtonMotion:state atPoint:translatedPoint.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3392
                    ]
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3393
                ] ifFalse:[
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3394
                    self selection:item openMenu:false.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3395
                    self openDelayed:item afterSeconds:0.1.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3396
                ].
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3397
            ] ifFalse:[ "/ processing in the toolbar
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3398
                (item notNil and:[self hasSelection and:[item canSelect]]) ifTrue:[
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3399
                    self selection:item openMenu:true.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3400
                ].
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3401
            ].
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3402
        ].
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3403
        ^ self
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3404
    ].
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3405
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3406
    containsPoint ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3407
        self selection:item openMenu:true.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3408
        ^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3409
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3410
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3411
    menu := self superMenuAtPoint:motionPoint.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3412
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3413
    menu notNil ifTrue:[
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3414
        translatedPoint := self translateMenuPoint:motionPoint toMenu:menu.
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3415
        menu handleButtonMotion:state atPoint:translatedPoint.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3416
        ^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3417
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3418
    self isPopUpView ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3419
        self selection:nil
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3420
    ].
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3421
!
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3422
3383
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  3423
handleButtonPress:button atPoint:aPoint
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3424
    "a button pressed; open or close the corresponding submenus"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3425
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3426
    |item scrollerDirectionOrNil wasSelected|
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3427
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3428
    item := self itemAtPoint:aPoint.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3429
    item isNil ifTrue:[
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3430
        self selection:nil openMenu:false.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3431
        ^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3432
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3433
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3434
    "/ is a scroller-button present and hit ?
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3435
    scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3436
    scrollerDirectionOrNil notNil ifTrue:[
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3437
        (self scrollActivity startIfRequiredAt:scrollerDirectionOrNil on:self comesViaButtonPress:true) ifTrue:[
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3438
            self pointerEntersItem:nil.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3439
            ^ self
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3440
        ]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3441
    ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3442
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3443
    "/ right button always immediately pulls the delayedMenu
3383
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  3444
    button == 2 ifTrue:[
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  3445
        item hasDelayedMenu ifTrue:[
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  3446
            self selection:item openMenu:false.
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  3447
            self openDelayed:item afterSeconds:0.
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  3448
            ^ self.
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  3449
        ].
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  3450
    ].
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  3451
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3452
    wasSelected := (selection == item).
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3453
    wasSelected ifFalse:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3454
        self selection:item openMenu:true
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3455
    ].
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3456
    item hasDelayedMenu ifTrue:[
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3457
        "/ clicked on the arrow icon ?
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3458
        (item menuIndicatorContains:aPoint) ifTrue:[
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3459
            self selection:item openMenu:false.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3460
            self openDelayed:item afterSeconds:0.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3461
            ^ self.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3462
        ].
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3463
        ^ self
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3464
    ].
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3465
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3466
    (item isToggle or:[item triggerOnDown]) ifFalse:[
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3467
        (wasSelected and:[item hasSubmenu and:[item visibleSubmenu isNil]]) ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3468
            item toggleSubmenuVisibility
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3469
        ].
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3470
        ^ self
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3471
    ].
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3472
    (item canAccept and:[item == self selection]) ifFalse:[
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3473
        ^ self
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3474
    ].
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3475
    self invalidateItem:item repairNow:true.
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3476
    self acceptItem:item inMenu:self.
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3477
3233
50bec260bddc bugfix - waiting for anyButtonPressede not
ca
parents: 3224
diff changeset
  3478
    [ (device notNil and:[device anyButtonPressed]) ] whileTrue:[
50bec260bddc bugfix - waiting for anyButtonPressede not
ca
parents: 3224
diff changeset
  3479
        "/ using device - sensor is not updated sometimes
50bec260bddc bugfix - waiting for anyButtonPressede not
ca
parents: 3224
diff changeset
  3480
        Delay waitForSeconds:0.1.
50bec260bddc bugfix - waiting for anyButtonPressede not
ca
parents: 3224
diff changeset
  3481
    ].
50bec260bddc bugfix - waiting for anyButtonPressede not
ca
parents: 3224
diff changeset
  3482
    self sensor flushUserEvents.
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3483
    self selection:nil.
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3484
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3485
    "Created: / 13.11.2001 / 14:12:04 / cg"
2047
62de65e3a61b initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents: 2046
diff changeset
  3486
    "Modified: / 13.11.2001 / 19:50:52 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3487
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3488
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3489
handleCursorKey:aKey
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3490
    "handle a cursor key"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3491
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3492
    |next menu item isVrt backKey p1 p2
2354
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3493
     idx0  "{ Class:SmallInteger }"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3494
     idx   "{ Class:SmallInteger }"
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3495
     size  "{ Class:SmallInteger }"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3496
    |
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3497
    (size  := items size) == 0 ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3498
        superMenu notNil ifTrue:[superMenu handleCursorKey:aKey].
2354
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3499
        ^ self
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3500
    ].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3501
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3502
    isVrt := self verticalLayout.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3503
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3504
    (    (isVrt     and:[aKey == #CursorUp    or:[aKey == #CursorDown]])
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3505
     or:[(isVrt not and:[aKey == #CursorRight or:[aKey == #CursorLeft]])]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3506
    ) ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3507
        selection isNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3508
            (superMenu notNil and:[superMenu verticalLayout == isVrt]) ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3509
                ^ superMenu handleCursorKey:aKey
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3510
            ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3511
            idx := 0.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3512
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3513
            isVrt ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3514
                "/ used because of vertical scrolling
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3515
                idx := items findFirst:[:el| el layout top > 0 ].
2354
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3516
                idx ~~ 0 ifTrue:[idx := idx - 1 ]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3517
            ].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3518
        ] ifFalse:[
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3519
            idx := self indexOf:selection.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3520
        ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3521
        next := aKey == #CursorRight or:[aKey == #CursorDown].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3522
2354
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3523
        idx0 := idx.
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3524
        size timesRepeat:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3525
            |el|
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3526
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3527
            next ifTrue:[idx := idx + 1] ifFalse:[idx := idx - 1].
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3528
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3529
            idx > size ifTrue:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3530
                idx := 0 "1"
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3531
            ] ifFalse:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3532
                idx < 0 ifTrue:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3533
                    idx := size
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3534
                ] 
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3535
            ].
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3536
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3537
            idx == 0 ifTrue:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3538
                self selection:nil.
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3539
                ^ self
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3540
            ] ifFalse:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3541
                (el := items at:idx ifAbsent:nil) notNil ifTrue:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3542
                    el canSelect ifTrue:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3543
                        el hasDelayedMenu ifTrue:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3544
                            "/ do not open menu
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3545
                            self selection:el openMenu:false
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3546
                        ] ifFalse:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3547
                            "/ open comes from style-sheet
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3548
                            self selection:el.
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3549
                        ].
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3550
                        ^ self
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3551
                    ].
2354
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3552
                ]
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3553
            ].
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3554
            idx == idx0 ifTrue:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3555
                ^ self
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3556
            ].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3557
        ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3558
        ^ self
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3559
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3560
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3561
    superMenu notNil ifTrue:[
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3562
        p1 := self translateGrabPoint:0.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3563
        p2 := superMenu translateGrabPoint:0.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3564
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3565
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3566
    isVrt ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3567
        (superMenu notNil and:[p1 x > p2 x]) ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3568
            backKey := #CursorRight
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3569
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3570
            backKey := #CursorLeft.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3571
        ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3572
    ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3573
        (superMenu notNil and:[p1 y > p2 y]) ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3574
            backKey := #CursorDown
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3575
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3576
            backKey := #CursorUp.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3577
        ]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3578
    ].    
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3579
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3580
    aKey == backKey ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3581
        superMenu isNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3582
            self accept:nil
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3583
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3584
            superMenu verticalLayout ~~ isVrt ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3585
                superMenu handleCursorKey:aKey
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3586
            ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3587
                superMenu selection hideSubmenu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3588
            ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3589
        ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3590
        ^ self
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3591
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3592
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3593
    selection isNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3594
        superMenu isNil ifTrue:[^ self accept:nil].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3595
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3596
        superMenu verticalLayout ~~ isVrt ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3597
            superMenu handleCursorKey:aKey
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3598
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3599
            (item := items findFirst:[:el| el canSelect]) notNil ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3600
                self selectionIndex:item
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3601
            ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3602
        ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3603
        ^ self
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3604
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3605
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3606
    selection hasSubmenu ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3607
        (menu := selection visibleSubmenu) isNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3608
            selection toggleSubmenuVisibility
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3609
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3610
            menu selectionIndex:1
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3611
        ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3612
    ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3613
        superMenu notNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3614
            superMenu verticalLayout ~~ isVrt ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3615
                superMenu handleCursorKey:aKey
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3616
            ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3617
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3618
            self accept:nil
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3619
        ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3620
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3621
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3622
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3623
handleKeyPress:key
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3624
    "any key is pressed"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3625
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3626
    |item inMenu|
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3627
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3628
    (key == #Return or:[key == Character space]) ifTrue:[
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3629
        self handleReturnPressed
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3630
    ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3631
        key isCharacter ifTrue:[
1862
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  3632
"/            selection notNil ifTrue:[
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  3633
"/                inMenu := self
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  3634
"/            ] ifFalse:[
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  3635
"/                (inMenu := superMenu) isNil ifTrue:[^ self].
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  3636
"/            ].
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  3637
            inMenu := self.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3638
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3639
            (item := inMenu detectItemForKey:key) notNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3640
                inMenu selection:item
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3641
            ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3642
        ] ifFalse:[
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3643
            (     key == #CursorDown or:[key == #CursorUp
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3644
              or:[key == #CursorLeft or:[key == #CursorRight]]]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3645
            ) ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3646
                self handleCursorKey:key
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3647
            ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3648
        ]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3649
    ]
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3650
!
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3651
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3652
handlePointerLeave:state
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3653
    self  pointerEntersItem:nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3654
    super pointerLeave:state
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3655
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3656
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3657
handleReturnPressed
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3658
    "any key is pressed"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3659
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3660
    |sensor subm item|
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3661
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3662
    (item := selection) isNil ifTrue:[
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3663
        superMenu notNil ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3664
            item := superMenu selection.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3665
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3666
            item value notNil ifTrue:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3667
                "/ is a delayed menu
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3668
                self accept:item
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3669
            ] ifFalse:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3670
                item toggleSubmenuVisibility
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3671
            ]
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3672
        ] ifFalse:[
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3673
            self accept
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3674
        ].
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3675
        ^ self
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3676
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3677
    selection hasSubmenu ifTrue:[
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3678
        selection hasDelayedMenu ifFalse:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3679
            selection toggleSubmenuVisibility.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3680
          ^ self
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3681
        ].
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3682
        subm := selection currentSubmenu.
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3683
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3684
        (subm notNil and:[subm shown]) ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3685
            selection toggleSubmenuVisibility.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3686
          ^ self
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3687
        ].
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3688
        self openDelayed:nil
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3689
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3690
    self accept.
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3691
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3692
    " test for toggle "
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3693
    item isToggle ifTrue:[
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3694
        self selection:item.
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3695
    ] ifFalse:[
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3696
        (selection notNil and:[selection triggerOnDown]) ifFalse:[
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3697
            ^ self
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3698
        ]
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3699
    ].    
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3700
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3701
    (sensor := self sensor) isNil ifTrue:[
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3702
        ^ self
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3703
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3704
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3705
    [   
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3706
        sensor flushKeyboardFor:nil.
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3707
        Delay waitForSeconds:0.1.
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3708
        sensor hasKeyPressEventFor:nil.
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3709
    ] whileTrue.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3710
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3711
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3712
pointerEntersItem:anItemOrNil
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3713
    "the pointer moves over an item or nil; restore the old item and
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3714
     redraw the new item highlighted."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3715
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3716
    |oldItem newItem|
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3717
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3718
    (     anItemOrNil notNil
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3719
     and:[anItemOrNil canSelect
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3720
     and:[selection isNil
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3721
     and:[self isPopUpView not]]]) ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3722
        anItemOrNil isButton ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3723
            (    self buttonEnteredBackgroundColor ~= self buttonPassiveBackgroundColor
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3724
             or:[self buttonEnteredLevel ~= self buttonPassiveLevel]
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3725
            ) ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3726
                newItem := anItemOrNil
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3727
            ]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3728
        ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3729
            (self enteredLevel ~~ 0 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3730
              or:[self enteredBackgroundColor ~= self backgroundColor]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3731
            ) ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3732
                newItem := anItemOrNil
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3733
            ]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3734
        ]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3735
    ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3736
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3737
    newItem ~~ enteredItem ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3738
        oldItem     := enteredItem.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3739
        enteredItem := newItem.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3740
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3741
        oldItem notNil ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3742
            self invalidateItem:oldItem repairNow:(enteredItem isNil).
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3743
        ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3744
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3745
        enteredItem notNil ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3746
            self invalidateItem:enteredItem repairNow:true.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3747
        ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3748
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3749
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3750
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3751
!MenuPanel methodsFor:'focus handling'!
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3752
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3753
canTab
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3754
    "depends whether I'am a toolbar and selectable items exists
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3755
    "
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3756
    |selectableItem|
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3757
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3758
    (super canTab and:[self isPopUpView not]) ifTrue:[
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3759
        selectableItem := self firstItemSelectable.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3760
        ^ selectableItem notNil
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3761
    ].
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3762
    ^ false
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3763
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3764
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3765
focusComesByTab
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3766
    "returns true if focus comes by tab and should be drawn
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3767
    "
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3768
    |focusComesByTab|
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3769
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3770
    focusComesByTab := self menuAdornmentAt:#focusComesByTab.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3771
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3772
    focusComesByTab == true ifTrue:[
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3773
        (shown and:[self hasFocus]) ifTrue:[
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3774
            ^ true
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3775
        ].
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3776
        self menuAdornmentAt:#focusComesByTab put:false.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3777
    ].
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3778
    ^ false
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3779
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3780
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3781
focusComesByTab:aBoolean
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3782
    "only handled for toolBars"
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3783
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3784
    |selectableItem|
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3785
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3786
    (self supportsFocusOnTab and:[self isPopUpView not]) ifTrue:[
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3787
        self menuAdornmentAt:#focusComesByTab put:aBoolean.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3788
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3789
        self hasSelection ifTrue:[
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3790
            ^ self
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3791
        ].
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3792
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3793
        aBoolean ifTrue:[
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3794
            selectableItem := self firstItemSelectable.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3795
        ].
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3796
        self selection:selectableItem openMenu:false.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3797
    ].
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3798
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3799
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3800
hasKeyboardFocus:aBoolean
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3801
    "notification from the windowGroup that I got/lost the keyboard focus."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3802
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3803
    |focusView|
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3804
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3805
    self isPopUpView ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3806
        "/ not visible for popup menus
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3807
        ^ super hasKeyboardFocus:aBoolean
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3808
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3809
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3810
    (aBoolean not and:[selection notNil]) ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3811
        hasImplicitGrap ~~ true ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3812
            focusView := windowGroup focusView.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3813
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3814
            focusView == self ifFalse:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3815
                self selection:nil.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3816
            ]
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3817
        ]
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3818
    ].            
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3819
    super hasKeyboardFocus:aBoolean.
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3820
!
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3821
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3822
showFocus:focusComesByTab
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3823
    self focusComesByTab:focusComesByTab.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3824
    super showFocus:focusComesByTab.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3825
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3826
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3827
showNoFocus:focusByTab
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3828
    self focusComesByTab:false.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3829
    super showNoFocus:focusByTab.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3830
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3831
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3832
supportsFocusOnTab
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3833
    "returns true if focus is supported
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3834
    "
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3835
    ^ (styleSheet at:#'focusHighlightStyle') == #win95
3158
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3836
!
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3837
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3838
wantsFocusWithButtonPress
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3839
    "needs only the focus if I'am a toolbar; all events are delegated
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3840
     to my subMenus"
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3841
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3842
    ^ self isPopUpView not
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3843
! !
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3844
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3845
!MenuPanel methodsFor:'grabbing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3846
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3847
doGrab
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3848
    relativeGrabOrigin := nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3849
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3850
    superMenu notNil ifTrue:[
3158
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3851
        superMenu doGrab
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3852
    ] ifFalse:[
3158
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3853
        hasImplicitGrap ~~ true ifTrue:[
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3854
            self grabMouseAndKeyboard.
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3855
            hasImplicitGrap := true
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3856
        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3857
    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3858
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3859
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3860
doUngrab:forceDo
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3861
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3862
    relativeGrabOrigin := nil.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3863
    self clearImplicitGrab.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3864
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3865
    superMenu notNil ifTrue:[
3158
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3866
        forceDo ifTrue:[
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3867
            superMenu doUngrab:true
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3868
        ].
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3869
        ^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3870
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3871
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3872
    hasImplicitGrap ~~ true ifTrue:[
3158
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3873
        ^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3874
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3875
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3876
    forceDo ifFalse:[
3158
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3877
        (selection notNil or:[prevFocusView == self]) ifTrue:[
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3878
            ^ self
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3879
        ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3880
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3881
    self ungrabMouseAndKeyboard.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3882
    self selection:nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3883
    hasImplicitGrap := nil.
1703
e127eff742bb bugfix: request focus
ca
parents: 1701
diff changeset
  3884
    prevFocusView   := nil.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3885
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3886
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3887
grabKeyboard
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3888
    "grap the keyboard; keep previous grab"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3889
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3890
    previousKeyboardGrab := device activeKeyboardGrab.
2713
9e417aa397c0 *** empty log message ***
ca
parents: 2712
diff changeset
  3891
    ^ super grabKeyboard
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3892
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3893
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3894
grabMouseAndKeyboard
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3895
    "get exclusive access to pointer and keyboard"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3896
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3897
    |winGroup sensor|
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3898
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3899
    winGroup := self windowGroup.
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3900
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3901
    (realized and:[winGroup notNil]) ifTrue:[
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3902
        prevFocusView isNil ifTrue:[
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3903
             prevFocusView := winGroup focusView.
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3904
        ].
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3905
        sensor := self sensor.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3906
        device activePointerGrab ~~ self ifTrue:[
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3907
            sensor flushMotionEventsFor:nil.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3908
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3909
            (self grabPointer) ifFalse:[
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3910
                Delay waitForSeconds:0.1.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3911
                (self grabPointer) ifFalse:[
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3912
                    "give up"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3913
                    'MenuPanel [warning]: could not grab pointer' errorPrintCR.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3914
                    self unmap
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3915
                ]
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3916
            ]
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3917
        ].
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3918
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3919
        device activeKeyboardGrab ~~ self ifTrue:[
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3920
            device sync.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3921
            sensor flushKeyboardFor:nil.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3922
            self grabKeyboard.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3923
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3924
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3925
3158
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3926
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3927
    "Modified: / 2.2.1998 / 23:43:59 / stefan"
1254
38b8bcfabbd7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1253
diff changeset
  3928
    "Modified: / 15.3.1999 / 12:01:38 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3929
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3930
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3931
grabPointerWithCursor:aCursorOrNil
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3932
    "grap the pointer; keep previous grab"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3933
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3934
    previousPointerGrab := device activePointerGrab.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3935
    hasImplicitGrap := true.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3936
    ^ super grabPointerWithCursor:aCursorOrNil
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3937
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3938
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3939
ungrabKeyboard
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3940
    "ungrap the keyboard; restore previous grab"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3941
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3942
    super ungrabKeyboard.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3943
2579
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  3944
    (previousKeyboardGrab notNil
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  3945
    and:[ previousKeyboardGrab realized ]) ifTrue:[
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  3946
        device grabKeyboardInView:previousKeyboardGrab.
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  3947
    ].
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3948
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3949
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3950
ungrabMouseAndKeyboard
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3951
    "ungrab resources (mouse and keyboard)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3952
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3953
    self ungrabPointer.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3954
    self ungrabKeyboard.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3955
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3956
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3957
ungrabPointer
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3958
    "ungrap the pointer; restore previous grab"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3959
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3960
    super ungrabPointer.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3961
2579
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  3962
    (previousPointerGrab notNil
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  3963
    and:[ previousPointerGrab realized ]) ifTrue:[
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  3964
        device grabPointerInView:previousPointerGrab.
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3965
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3966
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3967
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  3968
!MenuPanel methodsFor:'help'!
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  3969
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  3970
flyByHelpSpec
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  3971
    "allows subclasses to provide texts"
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  3972
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  3973
    ^ IdentityDictionary new
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  3974
!
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  3975
2058
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3976
flyByHelpTextAt:srcPoint
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3977
    "return the helpText for aPoint (i.e. when mouse-pointer is moved over an item).
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3978
     If there is a selection, that items helpText is used (ignoring the given point)."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3979
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  3980
    self withMenuAndItemAt:srcPoint do:[:menu :item | ^ menu flyByHelpTextForItem:item].
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  3981
    ^ nil
2058
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3982
!
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3983
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3984
flyByHelpTextForItem:anItem
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3985
    "returns the helpText for an item (empty if none)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3986
2063
8bff9e49f1e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2062
diff changeset
  3987
    anItem isNil ifTrue:[^ nil].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  3988
    ^ anItem flyByHelpText.
2058
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3989
!
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3990
3402
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3991
flyByHelpTextForKey:aKey
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3992
    |app text|
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3993
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  3994
    app := self application.
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  3995
    app notNil ifTrue:[
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  3996
        text := self application flyByHelpTextForKey:aKey.
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  3997
        text notNil ifTrue:[^ text].
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  3998
    ].
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  3999
    ^ self flyByHelpSpec at:aKey ifAbsent:nil
3402
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4000
!
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4001
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4002
helpText
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4003
    "return the helpText for the currently selected item (empty if none)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4004
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4005
    ^ self helpTextForItem:selection
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4006
!
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4007
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4008
helpTextAt:srcPoint
1252
6db6906da49b debug print
Claus Gittinger <cg@exept.de>
parents: 1251
diff changeset
  4009
    "return the helpText for aPoint (i.e. when mouse-pointer is moved over an item).
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4010
     If there is a selection, that items helpText is used (ignoreing the given point)."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4011
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4012
    self withMenuAndItemAt:srcPoint do:[:menu :item | ^ menu helpTextForItem:item].
2884
6e060df8f158 fix: MUST return nil, if there is no help text (not empty string !)
Claus Gittinger <cg@exept.de>
parents: 2883
diff changeset
  4013
    ^ nil
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4014
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4015
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4016
helpTextForItem:anItem
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4017
    "returns the helpText for an item (empty if none)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4018
2884
6e060df8f158 fix: MUST return nil, if there is no help text (not empty string !)
Claus Gittinger <cg@exept.de>
parents: 2883
diff changeset
  4019
    anItem isNil ifTrue:[^ nil].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  4020
    ^ anItem activeHelpText.
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4021
!
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4022
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4023
withMenuAndItemAt:srcPoint do:aBlock
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4024
    |dstMenu dstPoint item|
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4025
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4026
    dstMenu := self detectMenuAtGrabPoint:srcPoint.
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4027
    dstMenu notNil ifTrue:[
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4028
        dstPoint := dstMenu translateGrabPoint:srcPoint.
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4029
        item := dstMenu itemAtPoint:dstPoint.
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4030
        aBlock value:dstMenu value:item.
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4031
    ]
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4032
! !
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4033
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4034
!MenuPanel methodsFor:'image registration'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4035
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  4036
imageOnMyDevice:anImage
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4037
    "returns image registered on device"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4038
2770
d46f94ddabef *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2768
diff changeset
  4039
    ^ self class image:anImage value onDevice:device
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4040
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4041
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4042
lightenedImageOnDevice:anImage
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4043
    "returns lightened image registered on device"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4044
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4045
    ^ self class lightenedImage:anImage onDevice:device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4046
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4047
1688
271829d6a2e4 category changes
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  4048
!MenuPanel methodsFor:'initialization & release'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4049
767
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  4050
addToCurrentProject
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  4051
    "ignored here"
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  4052
!
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  4053
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4054
create
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4055
    "create the shadow view for a none contained submenu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4056
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4057
    super create.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4058
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4059
    self isPopUpView ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4060
        (PopUpView shadowsOnDevice:device) ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4061
            shadowView isNil ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4062
                shadowView := (ShadowView onDevice:device) for:self
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4063
            ] ifFalse:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4064
                self saveUnder:true.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4065
            ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4066
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4067
    ] ifFalse:[
3334
50374a42b3d9 use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents: 3332
diff changeset
  4068
        self hasExplicitExtent ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4069
            (self width) == (superView width) ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4070
                self verticalLayout:false
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4071
            ]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4072
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4073
    ]
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  4074
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  4075
    "Modified: / 28.7.1998 / 02:11:44 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4076
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4077
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4078
destroy
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4079
    "destroy items and shadowView; remove dependencies"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4080
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4081
    self clearLastActiveMenu.
2051
d958c12cc08e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  4082
    items notNil ifTrue:[items copy do:[:el|el destroy]].
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  4083
    items := nil.
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  4084
    self removeDependencies.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4085
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4086
    super destroy.
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4087
    prevFocusView := superMenu := nil.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4088
    shadowView notNil ifTrue:[shadowView destroy].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4089
2051
d958c12cc08e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  4090
    "Modified: / 15.11.2001 / 17:08:45 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4091
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4092
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4093
fetchDeviceResources
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4094
    "fetch device colors, to avoid reallocation at redraw time"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4095
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4096
    |style|
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4097
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4098
    superMenu notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4099
        styleSheet := superMenu styleSheet
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4100
    ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4101
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4102
    super fetchDeviceResources.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4103
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4104
    "/ 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
  4105
    "/ (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
  4106
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4107
    superMenu isNil ifTrue:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4108
        rightArrow isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4109
            rightArrow := SelectionInListView rightArrowFormOn:device.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  4110
        ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4111
        fgColor := fgColor onDevice:device.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4112
        style   := styleSheet name.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4113
2761
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  4114
        (style ~~ #os2 and:[style ~~ #win95 and:[style ~~ #winXP]]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4115
            rightArrowShadow := SelectionInListView rightArrowShadowFormOn:device
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4116
        ] ifFalse:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4117
            rightArrowShadow := nil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4118
        ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4119
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4120
        rightArrow       := superMenu rightArrow.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4121
        rightArrowShadow := superMenu rightArrowShadow.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4122
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4123
        self foregroundColor:(superMenu foregroundColor).
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4124
        self             font:(superMenu font).
2761
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  4125
"/        self  viewBackground:(superMenu viewBackground).
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  4126
    ].
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  4127
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  4128
    items notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4129
        items do:[:eachItem| eachItem fetchDeviceResources ]
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  4130
    ].
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  4131
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  4132
    "Modified: / 15.9.1998 / 12:51:29 / cg"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4133
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4134
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4135
initStyle
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4136
    "initialize style specific stuff"
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4137
2919
0c83b23cb6c6 resource directive
Claus Gittinger <cg@exept.de>
parents: 2895
diff changeset
  4138
    <resource: #style (#'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace'
0c83b23cb6c6 resource directive
Claus Gittinger <cg@exept.de>
parents: 2895
diff changeset
  4139
                       #'menu.buttonItemVerticalSpace'   #'menu.itemSpace'
0c83b23cb6c6 resource directive
Claus Gittinger <cg@exept.de>
parents: 2895
diff changeset
  4140
                       #'menu.itemHorizontalSpace'       
0c83b23cb6c6 resource directive
Claus Gittinger <cg@exept.de>
parents: 2895
diff changeset
  4141
                       #'popup.hideOnRelease'
0c83b23cb6c6 resource directive
Claus Gittinger <cg@exept.de>
parents: 2895
diff changeset
  4142
                       )>
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  4143
    |fn|
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  4144
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4145
    super initStyle.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4146
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4147
    buttonInsetX := styleSheet at:#'menu.buttonItemHorizontalSpace'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4148
    buttonInsetX isNil ifTrue:[ buttonInsetX := styleSheet at:#'menu.buttonItemSpace' default:0 ].
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4149
    buttonInsetX := buttonInsetX abs.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4150
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4151
    buttonInsetY := styleSheet at:#'menu.buttonItemVerticalSpace'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4152
    buttonInsetY isNil ifTrue:[ buttonInsetY := styleSheet at:#'menu.buttonItemSpace' default:0 ].
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4153
    buttonInsetY := buttonInsetY abs.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4154
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4155
    itemSpace := styleSheet at:#'menu.itemHorizontalSpace'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4156
    itemSpace isNil ifTrue:[ itemSpace := styleSheet at:#'menu.itemSpace' default:[ font widthOf:' '] ].
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4157
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4158
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  4159
    fgColor := DefaultForegroundColor ? Color black.
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  4160
    DefaultBackgroundColor notNil ifTrue:[ viewBackground := DefaultBackgroundColor ].
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  4161
    fn := self class defaultFont.
2610
a30fc1fb35d7 *** empty log message ***
ca
parents: 2609
diff changeset
  4162
    fn notNil ifTrue:[ self font:fn ].
1923
530426a3d692 support #level:
ca
parents: 1922
diff changeset
  4163
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4164
    defaultHideOnRelease := styleSheet at:#'popup.hideOnRelease' default:true.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4165
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4166
    self updateLevelAndBorder.
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4167
!
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4168
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4169
initialize
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4170
    "set default configuration"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4171
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4172
    super initialize.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4173
2877
6f7df547445b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  4174
    self enableMotionEvents.  "/ for flyByHelp
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  4175
    enabled := true.
1877
3b415fa4710f only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents: 1874
diff changeset
  4176
    self extentChangedFlag:false.
3b415fa4710f only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents: 1874
diff changeset
  4177
    self originChangedFlag:false.
3334
50374a42b3d9 use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents: 3332
diff changeset
  4178
    "/ explicitExtent      := nil.
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4179
    shortKeyInset       := 0.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4180
    mustRearrange       := false.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4181
    showSeparatingLines := false.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4182
    showGroupDivider    := true.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4183
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4184
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  4185
map
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  4186
    "grab the pointer here, when visible (but not if control has already been lost). 
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4187
     If the grab fails, try again and unmap myself if that fails too."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4188
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4189
    |loIndices loItems|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4190
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4191
    enteredItem := nil.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4192
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  4193
    self enableMotionEvents.
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4194
    self becomesActiveMenu.
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  4195
    super map.
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  4196
    self addDependencies.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4197
1785
efa4cc8ca917 mnemonic behaviour changed
ca
parents: 1775
diff changeset
  4198
    loIndices := InitialSelectionQuerySignal query.
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4199
    loItems   := items ? #[].
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
    loItems do:[:anItem| anItem fetchImages ].
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4202
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4203
    self isPopUpView ifTrue:[
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  4204
        self doGrab
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4205
    ] ifFalse:[
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  4206
        super viewBackground:(self backgroundColor).
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  4207
    ].
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4208
    loItems do:[:el| el updateIndicators ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4209
1785
efa4cc8ca917 mnemonic behaviour changed
ca
parents: 1775
diff changeset
  4210
    loIndices size > 0 ifTrue:[
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  4211
        self redrawX:0 y:0 width:width height:height.
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  4212
        self openMenusFromItemIndices:loIndices.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4213
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4214
1177
cfd7f71639f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1164
diff changeset
  4215
    "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
  4216
    "Modified: / 18.3.1999 / 18:22:18 / stefan"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4217
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4218
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4219
realize
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4220
    "realize menu and shadowView"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4221
2761
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  4222
    |bgColor|
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  4223
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4224
    self isPopUpView ifTrue:[
2761
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  4225
        bgColor := styleSheet colorAt:'menu.backgroundColor'.
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  4226
        bgColor notNil ifTrue:[ self viewBackground:bgColor ].
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  4227
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4228
        "Because of #saveUnder of ShadowView the order of realize is significant:
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4229
         shadowView must be realized before self"
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4230
        self hiddenOnRealize:true.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4231
        super realize.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4232
        self resize.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4233
        self makeFullyVisible.
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4234
"/        self mustRearrange.
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4235
        shadowView notNil ifTrue:[
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4236
            shadowView realize.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4237
        ].
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4238
        self raise.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4239
        self map.
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  4240
    ] ifFalse:[
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4241
        super realize.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4242
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4243
    self allSubViewsDo:[:aView| aView realize ].
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4244
    hideOnRelease := defaultHideOnRelease.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4245
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4246
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4247
recreate
1832
f6e6640e99a3 comment
Claus Gittinger <cg@exept.de>
parents: 1829
diff changeset
  4248
    "this is called after a snapin or a migration.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4249
     If the image was saved with an active menu, hide the menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4250
1455
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  4251
    selection := nil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4252
    super recreate.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4253
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4254
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4255
reinitStyle
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4256
    "handle style change while being open (win32 only - for now)"
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4257
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4258
    super reinitStyle.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4259
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4260
    self fetchDeviceResources.
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  4261
    self mustRearrange.      "/ care for changed font sizes etc.
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  4262
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  4263
    self do:[:anItem |
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  4264
        anItem reinitStyle
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  4265
    ].
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4266
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4267
    "Created: / 10.9.1998 / 21:37:05 / cg"
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  4268
    "Modified: / 17.8.2000 / 18:01:33 / cg"
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4269
!
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4270
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4271
unmap
1330
63d2fe5ebd48 comment
Claus Gittinger <cg@exept.de>
parents: 1313
diff changeset
  4272
    "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
  4273
     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
  4274
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  4275
    mapTime := nil.
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  4276
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  4277
    self removeDependencies.
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4278
    self clearLastActiveMenu.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4279
    self doUngrab:(superMenu isNil).
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4280
"/    self isPopUpView ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4281
"/         self doUngrab:(superMenu isNil)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4282
"/    ].
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4283
    prevFocusView := nil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4284
    super unmap.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4285
    shadowView notNil ifTrue:[shadowView unmap].
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4286
!
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4287
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4288
updateLevelAndBorder
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4289
    "update level & border, when it is known if I am a popUpView"
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4290
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4291
    |bw lvl|
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4292
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4293
    self isPopUpView ifTrue:[
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4294
        bw  := styleSheet at:#'popup.borderWidth' default:1.
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4295
        lvl := styleSheet at:#'popup.level'       default:0.
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4296
    ] ifFalse:[
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4297
        bw  := styleSheet is3D ifFalse:[1] ifTrue:[0].
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
  4298
        lvl := styleSheet at:#'pullDownMenu.level' default:1.
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4299
    ].
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4300
    self borderWidth:bw.
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4301
    self level:lvl.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4302
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4303
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4304
!MenuPanel methodsFor:'keyboard control'!
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4305
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4306
mnemonicViewNext:aKeyEvent
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4307
    "a  mnemonicKey event as forwarded from the keyboardProcessor - if there
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4308
     is the mnemonic-key defined for any menuItem, handle the menuItem and
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4309
     return the topMenu otherwise nil."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4310
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4311
    |menu uKey lKey list index accessCharacterMatchQuery maxShortCutSearchLevel|
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4312
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4313
    superMenu notNil ifTrue:[ ^ superMenu mnemonicViewNext:aKeyEvent ].
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4314
    shown ifFalse:[^ nil].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4315
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4316
    uKey := aKeyEvent rawKey last asUppercase.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4317
    lKey := uKey asLowercase.
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4318
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4319
    accessCharacterMatchQuery := [:el|
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4320
                                    |k| 
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4321
                                    k := el accessCharacter. 
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4322
                                    k == uKey or:[k == lKey]
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4323
                                 ].
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4324
    maxShortCutSearchLevel := self class maxShortCutSearchLevel.
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4325
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4326
    selection notNil ifTrue:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4327
        "first lookup the current grapMenu before starting in the topMenu
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4328
        "
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4329
        menu := self detectGrabMenu.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4330
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4331
        [ menu ~~ self ] whileTrue:[
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4332
            index := menu selectionIndex.
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4333
            list  := menu 
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4334
                        selectItemIndicesFor:accessCharacterMatchQuery
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4335
                        maxDepth:maxShortCutSearchLevel from:(index + 1) to:99999
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4336
                        ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ].
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4337
        
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4338
            list size ~~ 0 ifTrue:[
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4339
                "/ has item which responds to the mnemonic
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4340
                menu processCollectedIndices:list.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4341
                ^ self
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4342
            ].
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4343
            menu := menu superMenu.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4344
        ].
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4345
        index := self selectionIndex.
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4346
        list  := self 
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4347
                    selectItemIndicesFor:accessCharacterMatchQuery
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4348
                    maxDepth:maxShortCutSearchLevel from:(1 + index) to:99999
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4349
                    ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ].
2603
edb5408fd3e7 prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents: 2579
diff changeset
  4350
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4351
    ] ifFalse:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4352
        index := 99999.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4353
        list  := nil.
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4354
    ].    
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4355
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4356
    list isNil ifTrue:[
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4357
        list := self 
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4358
                    selectItemIndicesFor:accessCharacterMatchQuery
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4359
                    maxDepth:maxShortCutSearchLevel from:1 to:index
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4360
                    ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ].
2603
edb5408fd3e7 prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents: 2579
diff changeset
  4361
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4362
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4363
        list isNil ifTrue:[
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4364
            "/ must clear existing selection
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4365
            self selection:nil.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4366
            ^ nil
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4367
        ]
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4368
    ].
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4369
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4370
    "/ has item which responds to the mnemonic
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4371
    self processCollectedIndices:list.
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4372
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4373
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4374
openMenusFromItemIndices:anItemIndiceList
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4375
    "open all menus derived from sequence of item indices"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4376
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4377
    |item|
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4378
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4379
    anItemIndiceList size == 0 ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4380
        ^ self
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4381
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4382
    item := self itemAt:(anItemIndiceList removeFirst).
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4383
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4384
    (item notNil and:[item enabled]) ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4385
        InitialSelectionQuerySignal answer:anItemIndiceList do:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4386
            self selection:item openMenu:true.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4387
        ]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4388
    ].
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4389
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4390
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4391
processCollectedIndices:indices
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4392
    |menu item|
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4393
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4394
    indices size == 0 ifTrue:[
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  4395
        ^ self
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4396
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4397
    menu := self.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4398
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  4399
    "/ first lookup in current open submenus
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4400
    [menu selectionIndex == indices first] whileTrue:[
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  4401
        (    (item := menu selection) isNil
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  4402
         or:[(menu := item currentSubmenu) isNil]
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  4403
        ) ifTrue:[ "/ selected but no submenu open - not handled
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  4404
            ^ self
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  4405
        ].
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  4406
        indices removeFirst.
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  4407
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  4408
        indices isEmpty ifTrue:[
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  4409
           menu selection:nil.
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  4410
         ^ self
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  4411
        ]
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4412
    ].
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4413
    menu openMenusFromItemIndices:indices.
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4414
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4415
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4416
processShortcut:aKeyEvent
2926
0d6dc899b49f ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents: 2919
diff changeset
  4417
    "a shortcutKey event as forwarded from the keyboardProcessor.
0d6dc899b49f ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents: 2919
diff changeset
  4418
     If there is a shortcut-key defined, process it and return true.
0d6dc899b49f ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents: 2919
diff changeset
  4419
     Otherwise return false."
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4420
3431
ee7ea52cc2ad code refactored
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4421
    |menu rawKey logicalKey list item selectableItem|
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4422
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4423
    superMenu notNil ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4424
        ^ superMenu processShortcut:aKeyEvent
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4425
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4426
    shown ifFalse:[^ false].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4427
3431
ee7ea52cc2ad code refactored
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4428
    logicalKey := aKeyEvent key.
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4429
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4430
    "/ fast check, cursor keys are not supported
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4431
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  4432
    ( #( CursorDown CursorUp CursorRight CursorLeft Return Escape
3431
ee7ea52cc2ad code refactored
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4433
       ) includes:logicalKey
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4434
    ) ifTrue:[
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4435
        ^ false.
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4436
    ].
3431
ee7ea52cc2ad code refactored
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4437
    rawKey := aKeyEvent rawKey.
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4438
    item := nil.
3328
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4439
    menu := self detectGrabMenu. "/ first lookup the current grabMenu before starting in the topMenu
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4440
3394
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  4441
    "/ special for Cmd-only event (i.e. ALT-only)
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  4442
    aKeyEvent isKeyReleaseEvent ifTrue:[
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  4443
        selection isNil ifTrue:[
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  4444
            prevFocusView := self windowGroup focusView.
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  4445
            self requestFocus. "/ self windowGroup focusView:self.
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  4446
            selectableItem := self firstItemSelectable.
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  4447
            self selection:selectableItem openMenu:false.
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  4448
        ] ifFalse:[
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  4449
            prevFocusView requestFocus.
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  4450
            self selection:nil.
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  4451
        ].
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  4452
        ^ true
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  4453
    ].
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  4454
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4455
    [true] whileTrue:[
2926
0d6dc899b49f ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents: 2919
diff changeset
  4456
        list := menu 
0d6dc899b49f ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents: 2919
diff changeset
  4457
                    selectItemIndicesFor:[:el|
0d6dc899b49f ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents: 2919
diff changeset
  4458
                        |skey|
0d6dc899b49f ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents: 2919
diff changeset
  4459
0d6dc899b49f ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents: 2919
diff changeset
  4460
                        item := el.
0d6dc899b49f ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents: 2919
diff changeset
  4461
                        el ignoreShortcutKeys ifTrue:[
0d6dc899b49f ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents: 2919
diff changeset
  4462
                            false    
0d6dc899b49f ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents: 2919
diff changeset
  4463
                        ] ifFalse:[
0d6dc899b49f ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents: 2919
diff changeset
  4464
                            skey := el shortcutKey.
3431
ee7ea52cc2ad code refactored
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4465
                            skey == rawKey or:[skey == logicalKey]
2926
0d6dc899b49f ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents: 2919
diff changeset
  4466
                        ]
0d6dc899b49f ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents: 2919
diff changeset
  4467
                    ]
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4468
                    maxDepth:(self class maxShortCutSearchLevel) from:1 to:99999
2926
0d6dc899b49f ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents: 2919
diff changeset
  4469
                    ignoreSubmenuBlock:[:anItem | anItem ignoreShortcutKeys ].
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4470
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4471
        list size ~~ 0 ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4472
            "/ has item which responds to the shortcut
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4473
            item hasSubmenu ifFalse:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4474
                menu accept:item
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4475
            ] ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4476
                menu processCollectedIndices:list.
3394
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  4477
                self requestFocus. "/ self windowGroup focusView:self.
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4478
            ].
3394
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  4479
            ^ true
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4480
        ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4481
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4482
        menu == self ifTrue:[ ^ false ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4483
        menu := self.
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4484
    ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4485
    ^ false     "/ never reached
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4486
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4487
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4488
selectItemIndicesFor:aOneArgBlock maxDepth:maxDepth from:aStart to:aStop ignoreSubmenuBlock:ignoreSubmenueBlock
2603
edb5408fd3e7 prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents: 2579
diff changeset
  4489
    "returns the sequence of indices up to the item for which the block returns true.
edb5408fd3e7 prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents: 2579
diff changeset
  4490
     The first entry is the topmenu, the last entry the item for which the block returns
edb5408fd3e7 prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents: 2579
diff changeset
  4491
     true. If no item is detected, nil is returned.
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4492
     If the ignoreSubmenueBlock is not nil, the menu under the item (argument to the block)
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4493
     is created and passed through if the block returns false.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4494
     Otherwise the item is not asked for its submenu."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4495
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4496
    |start stop|
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4497
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4498
    maxDepth <= 0 ifTrue:[^ nil].
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4499
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4500
    start := aStart max:1.
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4501
    stop  := aStop  min:(items size).
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4502
3431
ee7ea52cc2ad code refactored
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4503
    start to:stop do:[:i| 
ee7ea52cc2ad code refactored
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4504
        |item menu result|
ee7ea52cc2ad code refactored
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4505
2603
edb5408fd3e7 prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents: 2579
diff changeset
  4506
        item := items at:i.
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4507
        (item enabled and:[item isVisible]) ifTrue:[
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4508
            (aOneArgBlock value:item) ifTrue:[
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4509
                ^ OrderedCollection with:i
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4510
            ].
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4511
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4512
            maxDepth > 1 ifTrue:[
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4513
                (item hasSubmenu and:[item hasDelayedMenu not]) ifTrue:[
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4514
                    (ignoreSubmenueBlock isNil or:[(ignoreSubmenueBlock value:item) not]) ifTrue:[
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  4515
                        menu := item setupSubmenu.
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4516
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4517
                        (menu notNil and:[menu isEnabled]) ifTrue:[
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4518
                            result := menu 
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4519
                                        selectItemIndicesFor:aOneArgBlock
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4520
                                        maxDepth:(maxDepth - 1) from:1 to:99999
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4521
                                        ignoreSubmenuBlock:ignoreSubmenueBlock.
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4522
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4523
                            result notNil ifTrue:[
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4524
                                result addFirst:i.
3128
9b92638bbd58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  4525
                                ^ result
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4526
                            ].
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4527
                        ].
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4528
                    ].
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4529
                ].
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4530
            ].
2603
edb5408fd3e7 prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents: 2579
diff changeset
  4531
        ].
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4532
    ].
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4533
    ^ nil
3128
9b92638bbd58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  4534
9b92638bbd58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  4535
    "Modified: / 18-10-2006 / 10:30:00 / cg"
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4536
! !
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4537
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4538
!MenuPanel methodsFor:'misc'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4539
427
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  4540
raiseDeiconified
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  4541
    ^ self raise
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  4542
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  4543
    "Created: 21.6.1997 / 13:29:12 / cg"
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  4544
!
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  4545
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4546
superMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4547
    "returns supermenu or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4548
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4549
    ^ superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4550
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4551
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4552
topMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4553
    "returns the topMenu; the one having no superMenu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4554
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4555
    |menu smenu|
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4556
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4557
    menu := self.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4558
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4559
    [(smenu := menu superMenu) notNil] whileTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4560
        menu := smenu
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4561
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4562
    ^ menu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4563
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4564
1825
962390f1b499 category change
Claus Gittinger <cg@exept.de>
parents: 1824
diff changeset
  4565
!MenuPanel methodsFor:'printing & storing'!
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4566
3360
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  4567
printOn:aStream
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  4568
    |label|
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  4569
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  4570
    aStream nextPutAll:'Menu:'.
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  4571
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  4572
    self do:[:eachItem|
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  4573
        label  := eachItem label.
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  4574
        label notEmptyOrNil ifTrue:[
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  4575
            aStream nextPutAll:'  '.
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  4576
            label printOn:aStream.
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  4577
        ].
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  4578
    ].
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4579
! !
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4580
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4581
!MenuPanel methodsFor:'private'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4582
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  4583
application
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4584
    "optimize access to retrive the application"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4585
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4586
    application notNil ifTrue:[^ application ].
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  4587
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  4588
    superMenu notNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4589
        application := superMenu application.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4590
        ^ application
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4591
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4592
    application := super application.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4593
    ^ application
1872
b20e27632fd8 application fetch fix
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  4594
!
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  4595
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4596
detectItemForKey:aKey
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4597
    "returns the item assigned to a key, accessCharacter or starts with.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4598
     if no item is detected nil is returned."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4599
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4600
    |cIdx uKey lKey item|
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4601
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4602
    items isNil ifTrue:[^ nil].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4603
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4604
    cIdx := self selectionIndex.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4605
    uKey := aKey asUppercase.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4606
    lKey := aKey asLowercase.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4607
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4608
    items keysAndValuesDo:[:anIndex :anItem| |char label|
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4609
        (     anIndex ~~ cIdx
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4610
         and:[anItem canSelect
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4611
         and:[(label := anItem textLabel) notNil
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4612
         and:[label size ~~ 0]]]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4613
        ) ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4614
            (char := anItem accessCharacter) notNil ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4615
                (char == uKey or:[char == lKey]) ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4616
                    ^ anItem
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4617
                ]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4618
            ] ifFalse:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4619
                char := label at:1.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4620
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4621
                (char == uKey or:[char == lKey]) ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4622
                    anIndex > cIdx ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4623
                        ^ anItem
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4624
                    ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4625
                    item isNil ifTrue:[item := anItem]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4626
                ]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4627
            ]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4628
        ]
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4629
    ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4630
    ^ item
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4631
!
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4632
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4633
menuAdornmentAt:aSymbol
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4634
    "returns a value derived from adornment"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4635
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4636
    adornment isNil ifTrue:[^ nil].
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4637
    ^ adornment at:aSymbol ifAbsent:nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4638
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4639
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4640
menuAdornmentAt:aSymbol put:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4641
    "sets a value for the specific menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4642
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4643
    |oldValue|
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4644
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  4645
    adornment isNil ifTrue:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4646
        something isNil ifTrue:[^ self].
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4647
        adornment := IdentityDictionary new.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4648
    ] ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4649
        oldValue := adornment at:aSymbol ifAbsent:nil.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4650
        oldValue == something ifTrue:[^ self].
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  4651
    ].
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  4652
    adornment at:aSymbol put:something.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4653
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4654
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4655
onEachPerform:aSelector withArgList:aList
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4656
    "on each item perform selector with an argument derived from aList"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4657
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4658
    aList isCollection ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4659
        items size >= aList size ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4660
            aList keysAndValuesDo:[:anIndex :anArg|
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4661
                (items at:anIndex) perform:aSelector with:anArg
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4662
            ]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4663
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4664
    ] ifFalse:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4665
        self do:[:anItem| anItem perform:aSelector with:aList ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4666
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4667
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4668
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4669
registerImageOnDevice:anImage
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4670
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4671
    anImage isNil ifTrue:[ ^ nil ].
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4672
  ^ self class image:anImage onDevice:device
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4673
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4674
"/    |image|
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4675
"/
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4676
"/    (image := anImage) notNil ifTrue:[
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4677
"/        image device ~~ device ifTrue:[
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4678
"/            image := image copy.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4679
"/        ].
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4680
"/        image := image onDevice:device.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4681
"/        image := image clearMaskedPixels.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4682
"/    ].
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4683
"/    ^ image
2355
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4684
!
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4685
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4686
superMenu:aSuperMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4687
    "set my supermenu from which i'am activated"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4688
2355
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4689
    superMenu := aSuperMenu.
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4690
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4691
    superMenu notNil ifTrue:[
2355
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4692
        styleSheet       := superMenu styleSheet.
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4693
        rightArrow       := superMenu rightArrow.
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4694
        rightArrowShadow := superMenu rightArrowShadow.
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4695
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4696
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4697
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4698
!MenuPanel methodsFor:'private-activation'!
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4699
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4700
activeMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4701
    "returns the current active menu or self (the top menu)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4702
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4703
    ^ lastActiveMenu ? self
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4704
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4705
    "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
  4706
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4707
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4708
activeMenu:aMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4709
    "set the current active menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4710
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4711
    lastActiveMenu := aMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4712
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4713
    "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
  4714
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4715
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4716
becomesActiveMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4717
    "submenu becomes the active menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4718
3224
96aba140912d bugfix for mapTime
ca
parents: 3222
diff changeset
  4719
    mapTime isNil ifTrue:[
96aba140912d bugfix for mapTime
ca
parents: 3222
diff changeset
  4720
        "/ set the mapTime if not yet done
96aba140912d bugfix for mapTime
ca
parents: 3222
diff changeset
  4721
        mapTime := AbsoluteTime now.
96aba140912d bugfix for mapTime
ca
parents: 3222
diff changeset
  4722
    ].
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4723
    self topMenu activeMenu:self.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4724
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4725
    "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
  4726
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4727
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4728
clearLastActiveMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4729
    "reset the current active menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4730
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4731
    |top|
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4732
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4733
    top := self topMenu.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4734
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4735
"/    prevFocusView notNil ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4736
"/        self windowGroup focusView:prevFocusView.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4737
"/        prevFocusView := nil.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4738
"/    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4739
"/
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4740
    top activeMenu == self ifTrue:[
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4741
        top activeMenu:nil
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4742
    ]
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4743
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4744
    "Created: / 27.2.1998 / 17:41:17 / cg"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4745
!
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4746
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4747
mapTime
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  4748
    "get the time the menu was activated or nil"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4749
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4750
    ^ mapTime
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4751
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4752
    "Modified: / 27.2.1998 / 17:41:18 / cg"
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  4753
!
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  4754
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  4755
mapTime:aTimestamp
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  4756
    "set the time the menu was activated"
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  4757
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  4758
    mapTime := aTimestamp.
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  4759
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  4760
    "Modified: / 27.2.1998 / 17:41:18 / cg"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4761
! !
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4762
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4763
!MenuPanel methodsFor:'private-scrolling'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4764
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4765
hasScrollerAt:aDirection
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4766
    "returns true if a visible scroller at a direction exists"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4767
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4768
    |layout|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4769
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4770
    self hasScrollers ifFalse:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4771
        ^ false
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4772
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4773
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4774
    aDirection == #PREV ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4775
        layout := items first layout.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4776
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4777
      ^ self verticalLayout ifTrue:[ layout top  < margin]
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4778
                           ifFalse:[ layout left < margin]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4779
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4780
    layout := items last layout.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4781
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4782
  ^ self verticalLayout ifTrue:[ layout bottom > (height - margin)]
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4783
                       ifFalse:[ layout right  > (width  - margin)]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4784
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4785
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4786
hasScrollers
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4787
    "returns true if scrollers are needed"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4788
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4789
    |maxExtent first last isVert|
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4790
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  4791
    (mustRearrange or:[items size <= 1]) ifTrue:[^ false].
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4792
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4793
    isVert := self verticalLayout.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4794
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4795
    superView notNil ifTrue:[
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  4796
        ((first := items first layout) isNil
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  4797
         or:[(last  := items last layout) isNil]
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4798
        ) ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4799
            ^ false
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4800
        ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4801
        isVert ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4802
            ^ first top < 0 or:[last bottom > height]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4803
        ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4804
        ^ first left < 0 or:[last right > width]
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4805
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4806
    maxExtent := self maxExtent.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4807
    isVert ifTrue:[
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  4808
        ^ (height >= maxExtent y)
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  4809
    ].
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  4810
    ^ (width >= maxExtent x)
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4811
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4812
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4813
indexOfItemAtScroller:aDirection
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4814
    "returns the index of the item under the scroller or 0"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4815
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4816
    |bounds min max layout|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4817
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  4818
    self hasScrollers ifFalse:[ ^ 0 ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4819
    bounds := self scrollerBoundsAt:aDirection.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4820
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4821
    self verticalLayout ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4822
        min := bounds top.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4823
        max := bounds bottom.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4824
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4825
        items keysAndValuesDo:[:anIndex :anItem|
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4826
            anItem isVisible ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4827
                layout := anItem layout.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4828
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4829
                (layout top < max and:[layout bottom > min]) ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4830
                    ^ anIndex
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4831
                ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4832
            ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4833
        ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4834
    ] ifFalse:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4835
        min := bounds left.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4836
        max := bounds right.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4837
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4838
        items keysAndValuesDo:[:anIndex :anItem|
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4839
            anItem isVisible ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4840
                layout := anItem layout.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4841
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4842
                (layout left < max and:[layout right > min]) ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4843
                    ^ anIndex
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4844
                ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4845
            ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4846
        ]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4847
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4848
    ^ 0
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4849
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4850
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4851
makeItemVisible:anItem
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4852
    "make an item visible"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4853
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4854
    |boundsPREV boundsNEXT delta layout index scr0 scr1 windowSz scrSz doScroll
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4855
     isVertical boundsMin layoutMin boundsMax layoutMax dltOrg
2042
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  4856
     inv1 inv2|
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4857
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4858
    (     anItem notNil
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4859
     and:[self hasScrollers
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4860
     and:[(layout := anItem layout) notNil]]
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4861
    ) ifFalse:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4862
        ^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4863
    ].
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4864
    index      := self indexOfItem:anItem.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4865
    boundsPREV := self scrollerBoundsAt:#PREV.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4866
    boundsNEXT := self scrollerBoundsAt:#NEXT.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4867
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4868
    isVertical := self verticalLayout.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4869
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4870
    isVertical ifTrue:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4871
        boundsMin := boundsPREV bottom.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4872
        boundsMax := boundsNEXT top.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4873
        layoutMin := layout top.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4874
        layoutMax := layout bottom.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4875
        windowSz  := height.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4876
    ] ifFalse:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4877
        boundsMin := boundsPREV right.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4878
        boundsMax := boundsNEXT left.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4879
        layoutMin := layout left.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4880
        layoutMax := layout right.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4881
        windowSz  := width.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4882
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4883
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4884
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4885
    layoutMin < boundsMin ifTrue:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4886
        layoutMin >= 0 ifTrue:[
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4887
            ^ self
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4888
        ].
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4889
        "/ test whether is first visible item
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4890
        index := items findLast:[:el| el isVisible] startingAt:(index - 1).
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4891
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4892
        index == 0 ifTrue:[ scr0 := margin ]
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4893
                  ifFalse:[ scr0 := boundsMin ].
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4894
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4895
        delta := layoutMin negated + scr0.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4896
    ] ifFalse:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4897
        layoutMax > boundsMax ifFalse:[
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4898
            ^ self
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4899
        ].
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4900
        "/ test whether is last visible item
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4901
        index  := items findFirst:[:el| el isVisible ] startingAt:(index + 1).
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4902
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4903
        index == 0 ifTrue:[ scr0 := windowSz - margin ]
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4904
                  ifFalse:[ scr0 := boundsMax ].
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4905
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4906
        delta := scr0 - layoutMax.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4907
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4908
    delta == 0 ifTrue:[ ^ self ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4909
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4910
    doScroll := false.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4911
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4912
    shown ifTrue:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4913
        delta abs < (windowSz / 2) ifTrue:[
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4914
            doScroll := true.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4915
            self repairDamage
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4916
        ]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4917
    ].
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4918
    isVertical ifTrue:[ dltOrg := 0@delta ] ifFalse:[dltOrg := delta@0].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4919
    items do:[:el| el moveBy:dltOrg ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4920
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4921
    doScroll ifFalse:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4922
        self invalidate.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4923
        ^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4924
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4925
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4926
    windowSz  := windowSz - margin - margin.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4927
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4928
    scr0  := boundsMin.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4929
    scr1  := scr0 + delta abs.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4930
    scrSz := boundsMax - scr1.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4931
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4932
    delta < 0 ifTrue:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4933
        isVertical ifTrue:[
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4934
            self copyFrom:self x:margin y:scr1 toX:margin y:scr0
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4935
                           width:windowSz height:scrSz async:false.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4936
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4937
            scr1 := scr0 + scrSz.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4938
            inv2 := (margin @ scr1) extent:(windowSz @ (height - scr1 - margin)).
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4939
            "/ self invalidateX:margin y:scr1 width:windowSz height:(height - scr1 - margin).
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4940
        ] ifFalse:[
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4941
            self copyFrom:self x:scr1 y:margin toX:scr0 y:margin
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4942
                           width:scrSz height:windowSz async:false.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4943
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4944
            scr1 := scr0 + scrSz.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4945
            inv2 := (scr1 @ margin) extent:((width - scr1 - margin) @ windowSz).
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4946
            "/ self invalidateX:scr1 y:margin width:(width - scr1 - margin) height:windowSz.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4947
        ].
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4948
        inv1 := boundsPREV.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4949
    ] ifFalse:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4950
        isVertical ifTrue:[
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4951
            self copyFrom:self x:margin y:scr0 toX:margin y:scr1
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4952
                           width:windowSz height:scrSz async:false.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4953
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4954
            inv2 := (margin @ margin) extent:(windowSz @ (scr1 - margin)).
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4955
            "/ self invalidateX:margin y:margin width:windowSz height:scr1 - margin.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4956
        ] ifFalse:[
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4957
            self copyFrom:self x:scr0 y:margin toX:scr1 y:margin
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4958
                           width:scrSz height:windowSz async:false.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4959
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4960
            inv2 := (margin @ margin) extent:(scr1 - margin) @ windowSz.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4961
            "/ self invalidateX:margin y:margin width:scr1 - margin height:windowSz.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4962
        ].
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4963
        inv1 := boundsNEXT.
2042
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  4964
    ].
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  4965
    self invalidate:inv1.
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  4966
    self invalidate:inv2.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  4967
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  4968
    "Modified: / 13.11.2001 / 20:26:42 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4969
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4970
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4971
scrollActivity
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4972
    "returns the one and only scrollActivity - data holder
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4973
     for a menu and all contained submenus"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4974
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4975
    superMenu notNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4976
        ^ superMenu scrollActivity
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4977
    ].
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4978
    scrollActivity isNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4979
        scrollActivity := ScrollActivity new.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4980
    ].
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4981
    ^ scrollActivity
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4982
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4983
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4984
scrollerBoundsAt:aDirection
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  4985
    "returns the bounds of the scroller at a direction"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4986
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4987
    |y x w h inset|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4988
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4989
    inset := 0.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4990
    x := y := inset.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4991
    w := h := 15.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4992
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4993
    self verticalLayout ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4994
        aDirection == #NEXT ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4995
            y := height - h - inset.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4996
        ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4997
        w := width - inset - inset.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4998
    ] ifFalse:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4999
        aDirection == #NEXT ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5000
            x := width - w - inset.       
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5001
        ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5002
        h := height - inset - inset.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5003
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5004
    ^ Rectangle left:x top:y width:w height:h
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5005
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5006
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5007
scrollerDirectionAtPoint:aPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5008
    "returns the scroller-direction at aPoint, or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5009
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5010
    self hasScrollers ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5011
        #( PREV NEXT ) do:[:aDirection| |bounds|
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  5012
            bounds := self scrollerBoundsAt:aDirection.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  5013
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  5014
            (bounds containsPoint:aPoint) ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5015
                ^ (self hasScrollerAt:aDirection) ifTrue:[aDirection] ifFalse:[nil]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5016
            ]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5017
        ]
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5018
    ].
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5019
    ^ nil
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5020
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5021
    "Created: / 13.11.2001 / 14:13:16 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5022
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5023
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5024
!MenuPanel methodsFor:'private-searching'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5025
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5026
detectGrabMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5027
    "returns the menu which is responsible for the grap; the last opened menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5028
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5029
    |subMenu|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5030
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5031
    selection notNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5032
        (subMenu := selection visibleSubmenu) notNil ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5033
            ^ subMenu detectGrabMenu
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5034
        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5035
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5036
    ^ self
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5037
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5038
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5039
detectMenuAtGrabPoint:aGrabPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5040
    "returns the menu which contains the grab-point"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5041
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5042
    |dstMenu dstPoint firstMenu|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5043
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5044
    dstPoint := self translateGrabPoint:aGrabPoint.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5045
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5046
    ((dstPoint x between:0 and:width) and:[dstPoint y between:0 and:height]) ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5047
        firstMenu := self.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5048
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5049
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5050
    (selection isNil or:[(dstMenu := selection visibleSubmenu) isNil]) ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5051
        ^ firstMenu
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5052
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5053
    dstMenu := dstMenu detectMenuAtGrabPoint:aGrabPoint.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  5054
    ^ dstMenu ? firstMenu
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5055
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5056
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5057
detectViewAtX:x y:y in:aTopView
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5058
    "detect view at x@y"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5059
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5060
    ^ aTopView detectViewAt:(x@y).
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5061
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5062
"/ cg: old code was (refactored to use common code)
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5063
"/
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5064
"/    |p subViews|
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5065
"/
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5066
"/    (subViews := aTopView subViews) notNil ifTrue:[
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5067
"/        subViews do:[:v| |p|
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5068
"/            v shown ifTrue:[
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5069
"/                (    (x between:(v left) and:(v right))
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5070
"/                 and:[y between:(v top)  and:(v bottom)]
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5071
"/                ) ifTrue:[
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5072
"/                    p := device translatePoint:(x@y) from:(aTopView id) to:(v id).
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5073
"/                  ^ self detectViewAtX:p x y:p y in:v.
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5074
"/                ]
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5075
"/            ]
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5076
"/        ]
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5077
"/    ].
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5078
"/    ^ aTopView
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5079
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5080
    "Modified: / 10.10.2001 / 13:45:56 / cg"
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5081
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5082
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5083
itemAt:stringOrNumberOrPoint
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5084
    "returns item assigned to an index, nameKey, textLabel or value if symbol.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5085
     If no item match nil is returned."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5086
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5087
    |idx|
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5088
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5089
    stringOrNumberOrPoint isPoint ifTrue:[
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5090
        ^ self itemAtPoint:stringOrNumberOrPoint
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5091
    ].
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5092
    idx := self indexOf:stringOrNumberOrPoint.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5093
    (idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ].
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5094
    ^ nil
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5095
!
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5096
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5097
itemAtPoint:aPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5098
    "returns the item at aPoint or nil if none detected"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5099
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5100
    |x y|
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5101
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5102
    items notNil ifTrue:[
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5103
        x := aPoint x.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5104
        y := aPoint y.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5105
        ^ items detect:[:el| el containsPointX:x y:y] ifNone:nil
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5106
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5107
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5108
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5109
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  5110
superMenuAtPoint:aPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5111
    "returns the superMenu which contains aPoint, or nil if none detected"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5112
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5113
    |grabPoint superMenu|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5114
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  5115
    (self containsPoint:aPoint) ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5116
        ^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5117
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5118
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  5119
    grabPoint := aPoint - (self translateGrabPoint:0).
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5120
    superMenu := self.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5121
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5122
    [ (superMenu := superMenu superMenu) notNil ] whileTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5123
        (superMenu containsPoint:(superMenu translateGrabPoint:grabPoint)) ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5124
            ^ superMenu
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5125
        ]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5126
    ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5127
    ^ nil
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5128
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  5129
    "Created: / 13.11.2001 / 20:22:53 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5130
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5131
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5132
!MenuPanel methodsFor:'queries'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5133
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5134
container:aView
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5135
    super container:aView.
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5136
    aView notNil ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  5137
	"/ I am no longer a popUpView
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  5138
	self updateLevelAndBorder
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5139
    ].
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5140
!
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5141
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5142
containsPoint:aPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5143
    "returns true if the argument, aPoint is contained by the view"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5144
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5145
    ^ self containsPointX:(aPoint x) y:(aPoint y)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5146
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5147
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5148
containsPointX:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5149
    "returns true if point is contained by the view"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5150
708
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  5151
    ^ (x between:0 and:width) and:[y between:0 and:height]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5152
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5153
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5154
hasGroupDividerAt:anIndex
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5155
    "returns true if a divider is defined at an index"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5156
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5157
    |i|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5158
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5159
    groupSizes size ~~ 0 ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5160
        i := 0.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5161
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5162
        groupSizes do:[:t|
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5163
            (i := i + t) == anIndex ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5164
                ^ true
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5165
            ]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5166
        ]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5167
    ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5168
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5169
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5170
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5171
hasGroupDividers
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5172
    "returns true if any group divider exists"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5173
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5174
    ^ (items size ~~ 0 and:[groupSizes size ~~ 0])
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5175
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5176
3457
6f19c84f9ff8 Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents: 3454
diff changeset
  5177
isActive
6f19c84f9ff8 Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents: 3454
diff changeset
  5178
    "true, if I have the focus (w.r.t the windowing system);
6f19c84f9ff8 Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents: 3454
diff changeset
  5179
     i.e. if one of my subViews actually has the real focus.
6f19c84f9ff8 Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents: 3454
diff changeset
  5180
     With click-to-focus behavior, this is obviously the current application.
6f19c84f9ff8 Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents: 3454
diff changeset
  5181
     Use this query with caution, for example, to suppress tooltips for inactive apps.
6f19c84f9ff8 Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents: 3454
diff changeset
  5182
6f19c84f9ff8 Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents: 3454
diff changeset
  5183
     This should be only in TowView, but apparently MenuPanel is used as a TopView"
6f19c84f9ff8 Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents: 3454
diff changeset
  5184
6f19c84f9ff8 Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents: 3454
diff changeset
  5185
    ^ windowGroup notNil and:[windowGroup anyViewHasFocus] 
6f19c84f9ff8 Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents: 3454
diff changeset
  5186
!
6f19c84f9ff8 Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents: 3454
diff changeset
  5187
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5188
isFitPanel
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5189
    "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
  5190
     be fit to the extent of its superView;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5191
     NOT SUPPORTED"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5192
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5193
    ^ false
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5194
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5195
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5196
isPopUpView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5197
    "return true if view is a popup view; without decoration
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5198
     and popUp to top immediately"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5199
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5200
    ^ superView isNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5201
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5202
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5203
isVerticalLayout
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5204
    "returns true if vertical layout otherwise false( horizontal layout )"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5205
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5206
    ^ self verticalLayout
416
c05874084d4c implement
ca
parents: 407
diff changeset
  5207
!
c05874084d4c implement
ca
parents: 407
diff changeset
  5208
1793
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  5209
isViewWrapper
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  5210
    ^ items size == 0 and:[subViews size ~~ 0]
1793
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  5211
!
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  5212
416
c05874084d4c implement
ca
parents: 407
diff changeset
  5213
type
428
ca
parents: 427
diff changeset
  5214
    ^ nil.
416
c05874084d4c implement
ca
parents: 407
diff changeset
  5215
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5216
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5217
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5218
!MenuPanel methodsFor:'selection'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5219
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5220
hasSelection
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5221
    "returns true if a selection exists"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5222
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5223
    ^ self selection notNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5224
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5225
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5226
openDelayed:anItem
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  5227
    self openDelayed:anItem afterSeconds:0.5.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  5228
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  5229
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  5230
openDelayed:anItem afterSeconds:seconds
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5231
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5232
    superMenu notNil ifTrue:[
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  5233
        superMenu openDelayed:anItem afterSeconds:seconds.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5234
        ^ self
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5235
    ].
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5236
    openDelayedMenuBlock notNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  5237
        Processor removeTimedBlock:openDelayedMenuBlock.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  5238
        openDelayedMenuBlock := nil.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  5239
    ].
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  5240
    (anItem notNil and:[anItem hasSubmenu]) ifFalse:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  5241
        openDelayedMenuBlock := nil.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5242
        ^ self
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  5243
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  5244
    openDelayedMenuBlock := [
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  5245
        openDelayedMenuBlock := nil.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  5246
        anItem openDelayedSubmenu
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  5247
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  5248
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  5249
    Processor addTimedBlock:openDelayedMenuBlock afterSeconds:seconds.
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5250
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5251
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5252
selection
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5253
    "returns current selected item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5254
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5255
    ^ selection
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5256
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5257
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5258
selection:anItemOrNil
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5259
    "change selection to an item or nil
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5260
     if the item has a submenu the first item might be selected (style-sheet)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5261
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5262
    |openMenu openOnSelect submenu item|
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5263
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5264
    selection == anItemOrNil ifTrue:[^ self].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5265
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5266
    (anItemOrNil isNil or:[anItemOrNil hasSubmenu not]) ifTrue:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5267
        self selection:anItemOrNil openMenu:false.
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5268
        ^ self
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5269
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5270
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5271
    openMenu     := self isPopUpView not.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5272
    openOnSelect := styleSheet at:#'menu.openOnSelect' default:false.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5273
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5274
    openMenu ifFalse:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5275
        openMenu := openOnSelect.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5276
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5277
    self selection:anItemOrNil openMenu:openMenu.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5278
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5279
    openOnSelect ifFalse:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5280
        "/ select first item in submenu
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5281
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5282
        submenu := anItemOrNil currentSubmenu.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5283
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5284
        submenu notNil ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5285
            item := submenu itemAt:1.
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5286
            (item notNil and:[item hasSubmenu not]) ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5287
                submenu selection:item openMenu:false
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5288
            ]
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5289
        ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5290
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5291
!
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5292
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5293
selection:anItemOrNil openMenu:openMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5294
    "change selection to an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5295
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5296
    |helpListener oldSelect|
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5297
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5298
    anItemOrNil == selection ifTrue:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5299
        ^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5300
    ].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5301
    self openDelayed:nil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5302
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5303
    oldSelect := selection.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5304
    selection := nil.
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5305
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5306
    anItemOrNil notNil ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5307
        self makeItemVisible:anItemOrNil.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5308
        anItemOrNil canSelect ifTrue:[
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5309
            selection := anItemOrNil
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5310
        ] ifFalse:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5311
            oldSelect isNil ifTrue:[^ self].
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5312
        ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5313
    ].
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5314
    oldSelect notNil ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5315
        "/ clear current selection
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5316
        oldSelect isSelected:false.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5317
    ].
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5318
    selection isNil ifTrue:[^ self].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5319
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  5320
"/    selection == enteredItem ifTrue:[
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  5321
"/        enteredItem := nil
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  5322
"/    ] ifFalse:[
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  5323
"/        self pointerEntersItem:nil
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  5324
"/    ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5325
    ActiveHelp isActive ifTrue:[
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5326
        helpListener := ActiveHelp currentHelpListener.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5327
        helpListener initiateHelpFor:self at:nil now:true.
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5328
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5329
    shown ifTrue:[
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  5330
        "/ self rearrangeItems.
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5331
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5332
        openMenu ifFalse:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5333
            selection invalidate.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5334
        ]
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5335
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5336
    openMenu ifTrue:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5337
        selection isSelected:true.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5338
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5339
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5340
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5341
selectionIndex
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5342
    "returns index of current selection or 0"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5343
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5344
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5345
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5346
    (item := self selection) notNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5347
        ^ self findFirst:[:el| el == item ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5348
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5349
    ^ 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5350
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5351
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5352
selectionIndex:anIndex
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5353
    "set selection at an index"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5354
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5355
    self selection:(self itemAt:anIndex)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5356
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5357
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5358
!MenuPanel methodsFor:'translation'!
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5359
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5360
translateGrabPoint:aGrabPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5361
    "translate the grab point into self"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5362
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5363
    superMenu isNil ifTrue:[
2936
723062b99960 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2934
diff changeset
  5364
        "I am the grabView"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5365
        aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5366
        ^ aGrabPoint
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5367
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5368
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5369
    relativeGrabOrigin isNil ifTrue:[
2936
723062b99960 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2934
diff changeset
  5370
        relativeGrabOrigin := self topMenu translatePoint:0 to:self.    
723062b99960 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2934
diff changeset
  5371
        relativeGrabOrigin isNil ifTrue:[
723062b99960 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2934
diff changeset
  5372
            "I am the grabView"
723062b99960 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2934
diff changeset
  5373
            aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint].
723062b99960 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2934
diff changeset
  5374
            ^ aGrabPoint
723062b99960 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2934
diff changeset
  5375
        ].
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5376
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5377
    ^ relativeGrabOrigin + aGrabPoint
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5378
!
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5379
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5380
translateMenuPoint:aPoint toMenu:aMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5381
    "translate a point into another menu its point"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5382
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5383
    |grapPoint|
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5384
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5385
    aMenu == self ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5386
        ^ aPoint
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5387
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5388
    grapPoint := aPoint - (self translateGrabPoint:0).
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5389
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5390
    ^ aMenu translateGrabPoint:grapPoint
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5391
!
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5392
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5393
translatePoint:aPoint to:anotherWindowOrNilForScreen
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5394
    "translate a point in my window to anotherWindowOrNilForScreen (or root window if nil)"
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5395
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5396
    ^ device 
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5397
        translatePoint:aPoint asPoint 
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5398
        fromView:self 
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5399
        toView:anotherWindowOrNilForScreen
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5400
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5401
    "Modified: / 10.10.2001 / 14:11:47 / cg"
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5402
! !
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5403
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5404
!MenuPanel::Item class methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5405
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  5406
horizontalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  5407
    ^ HorizontalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  5408
!
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  5409
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5410
labelRightOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5411
    ^ LabelRightOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5412
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5413
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  5414
verticalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  5415
    ^ VerticalInset
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  5416
!
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  5417
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  5418
verticalPopUpInset
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  5419
    ^ VerticalPopUpInset
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5420
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5421
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  5422
!MenuPanel::Item class methodsFor:'defaults'!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  5423
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5424
halfSeparatorSize
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5425
    "returns the size of a space-separator"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5426
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5427
    ^ 5
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5428
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5429
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5430
separatorSize
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5431
    "returns the size of a separator"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5432
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5433
    ^ 10
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  5434
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  5435
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  5436
updateStyleCache
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  5437
    "extract values from the styleSheet and cache them in class variables"
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  5438
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  5439
    <resource: #style (#'menuPanel.verticalInset')>
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  5440
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5441
    HorizontalInset       := 2.
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  5442
    VerticalInset         := MenuPanel styleSheet at:#'menuPanel.verticalInset' default:2.
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  5443
    VerticalPopUpInset    := 2.
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  5444
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  5445
    HorizontalButtonInset := 3.
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  5446
    VerticalButtonInset   := 3.
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  5447
681
62c7cdaca188 extra default inset values for button behaviour added
tz
parents: 680
diff changeset
  5448
    LabelRightOffset      := 15.
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  5449
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  5450
    "
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  5451
     self updateStyleCache
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  5452
    "
1124
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  5453
! !
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  5454
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5455
!MenuPanel::Item class methodsFor:'instance creation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5456
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5457
in:aSuperMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5458
    ^ self in:aSuperMenu label:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5459
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5460
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5461
in:aSuperMenu label:aLabel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5462
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5463
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5464
    item := self new in:aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5465
    item label:aLabel.
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5466
    ^ item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5467
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5468
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5469
in:aSuperMenu menuItem:aMenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5470
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5471
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5472
    item := self in:aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5473
    item menuItem:aMenuItem.
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5474
    ^ item.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5475
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5476
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5477
new
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5478
    ^ self basicNew initialize
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5479
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5480
1808
e8628b502a49 methodCategory change
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
  5481
!MenuPanel::Item methodsFor:'accepting'!
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5482
420
ca
parents: 417
diff changeset
  5483
canAccept
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5484
    "returns true if item is acceptable"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5485
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5486
    self enabled    ifFalse:[ ^ false].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5487
    self hasSubmenu ifFalse:[ ^ true ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5488
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5489
    self hasDelayedMenu ifFalse:[^ false ].
3558
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
  5490
    ^ subMenu isNil or:[subMenu shown not]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5491
!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5492
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5493
toggleIndication
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5494
    "toggle indication or choice"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5495
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5496
    |arg|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5497
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5498
    indication notNil ifTrue:[    
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5499
        arg := self indicationValue not.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5500
        self indicationValue:arg.
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5501
    ] ifFalse:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5502
        choice notNil ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5503
            choice value:(menuItem choiceValue).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5504
            ^ true
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5505
        ]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5506
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5507
    ^ arg
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5508
! !
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5509
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5510
!MenuPanel::Item methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5511
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5512
accessCharacter
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5513
    "returns my accessCharacter or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5514
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5515
    ^ accessCharacter
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5516
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5517
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5518
accessCharacterPosition
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5519
    "get the access character position or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5520
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5521
    ^ menuItem accessCharacterPosition
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5522
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5523
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5524
accessCharacterPosition:anIndex 
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5525
    "set the access character position or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5526
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5527
    menuItem accessCharacterPosition:anIndex.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5528
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5529
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5530
argument
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5531
    "gets the argument"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5532
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5533
    ^ menuItem argument
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5534
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5535
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5536
argument:anArgument
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5537
    "sets the argument"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5538
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5539
    menuItem argument:anArgument.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5540
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5541
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5542
displayLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5543
    "returns my printable Label"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5544
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5545
    ^ displayLabel
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5546
!
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5547
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5548
displayLabelExtent
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5549
    "returns the labels extent"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5550
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5551
    |prevFont w h|
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5552
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5553
    displayLabelExtent notNil ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5554
        ^ displayLabelExtent
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5555
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5556
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5557
    displayLabel isNil ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5558
        displayLabelExtent := 0@0.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5559
        ^ displayLabelExtent
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5560
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5561
    prevFont := menuPanel setFont:(self font).
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5562
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5563
    displayLabel isArray ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5564
        w := h := 0.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5565
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5566
        displayLabel do:[:aSubLabel|
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5567
            aSubLabel notNil ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5568
                w := w max:(aSubLabel widthOn:menuPanel).
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5569
                h := h + 1 + (aSubLabel heightOn:menuPanel).
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5570
            ] ifFalse:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5571
                h := h + (self spaceBetweenEmptyLines)
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5572
            ]
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5573
        ]
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5574
    ] ifFalse:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5575
        w := displayLabel  widthOn:menuPanel.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5576
        h := displayLabel heightOn:menuPanel.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5577
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5578
    "/ care for italic fonts - give a few more pixels at the end
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5579
    menuPanel font italic ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5580
        w := w + 2.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5581
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5582
    displayLabelExtent := w@h.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5583
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5584
    prevFont notNil ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5585
        menuPanel setFont:prevFont.     "/ restore previous font
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5586
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5587
    ^ displayLabelExtent
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5588
!
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5589
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5590
font
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5591
    "returns the user configured font or nil (default menu font)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5592
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5593
    |font|
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5594
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5595
    menuPanel isNil ifTrue:[^ nil].
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5596
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5597
    font := menuItem font.
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5598
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5599
    font notNil ifTrue:[
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5600
        font := font onDevice:(menuPanel device).
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5601
        menuItem font:font.
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5602
    ].
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5603
    ^ font
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5604
!
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5605
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5606
font:aFont
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5607
    "returns the user configured font or nil (default menu font)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5608
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5609
    menuItem font:aFont.
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5610
!
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5611
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5612
ignoreMnemonicKeys
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5613
    "if true, mnemonic (access character) in the submenus under the item are ignored"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5614
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5615
    ^ menuItem ignoreMnemonicKeys
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5616
!
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5617
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5618
ignoreMnemonicKeys:aBoolean
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5619
    "if true, mnemonic (access character) in the submenus under the item are ignored"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5620
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5621
    menuItem ignoreMnemonicKeys:aBoolean.
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5622
!
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5623
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5624
ignoreShortcutKeys
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5625
    "if true, shortcutKeys (accelerators) in the submenus under the item are ignored"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5626
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5627
    ^ menuItem ignoreShortcutKeys
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5628
!
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5629
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5630
ignoreShortcutKeys:aBoolean
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5631
    "if true, shortcutKeys (accelerators) in the submenus under the item are ignored"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5632
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5633
    menuItem ignoreShortcutKeys:aBoolean.
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5634
!
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5635
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5636
itemValue
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5637
    "gets the items value"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5638
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5639
    ^ menuItem itemValue
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5640
!
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5641
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5642
itemValue:aValue
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5643
    "argument could be a value holder, an action or selector"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5644
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5645
    menuItem itemValue:aValue.
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5646
!
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5647
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5648
label
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5649
    "returns the label"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5650
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5651
    ^ label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5652
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5653
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5654
label:aLabel
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  5655
    "set a new label; if the label changed, a redraw is performed;
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5656
     handle characters $& (ST-80 compatibility)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5657
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5658
    |size char oldExtent|
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5659
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5660
    oldExtent          := displayLabelExtent.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5661
    displayLabelExtent := nil. "/ force a recomputation
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5662
    accessCharacter    := disabledDisplayLabel := nil.
3454
baefcb629718 Remove string specific acent handling instead of the generic #ascentOn: approach.
Stefan Vogel <sv@exept.de>
parents: 3447
diff changeset
  5663
baefcb629718 Remove string specific acent handling instead of the generic #ascentOn: approach.
Stefan Vogel <sv@exept.de>
parents: 3447
diff changeset
  5664
    "Stefan: Why do we use #value two times??"
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5665
    label              := aLabel value.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5666
    displayLabel       := label value ? ''.
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5667
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5668
    displayLabel isString ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5669
        "CHECK FOR SEPARATOR"
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5670
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5671
        (menuItem isButton not and:[indication isNil and:[choice isNil]]) ifTrue:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5672
            size := displayLabel size.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5673
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5674
            size == 0 ifTrue:[
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5675
                displayLabel := nil.            "blank separator"
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5676
                ^ self
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5677
            ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5678
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5679
            size == 1 ifTrue:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5680
                char := displayLabel first.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5681
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5682
                (char == $- or:[char == $=]) ifTrue:[
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5683
                    label := displayLabel.      "line separator"
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5684
                    displayLabel := nil.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5685
                    ^ self
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5686
                ]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5687
            ]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5688
        ]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5689
    ] ifFalse:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5690
        displayLabel isCollection ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5691
            displayLabel := displayLabel asArray.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5692
        ]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5693
    ].
3328
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5694
    menuPanel doAccessCharacterTranslation ifTrue:[
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5695
        displayLabel notNil ifTrue:[
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5696
            displayLabel isArray ifTrue:[
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5697
                displayLabel keysAndValuesDo:[:i :el|
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5698
                    el notNil ifTrue:[
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5699
                        displayLabel at:i put:(self updateAccessCharacterFor:el).
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5700
                    ].
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5701
                ].
3328
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5702
            ] ifFalse:[
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5703
                displayLabel := self updateAccessCharacterFor:displayLabel.
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5704
            ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5705
        ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5706
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5707
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5708
    menuPanel shown ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5709
        self fetchImages.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5710
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5711
        oldExtent = self displayLabelExtent ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5712
            self invalidate
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5713
        ] ifFalse:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5714
            menuPanel mustRearrange
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5715
        ]
1978
a53447b8cbe2 set label; reange menu if extent changed otherwise redraw only the item
martin
parents: 1955
diff changeset
  5716
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5717
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5718
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5719
menuPanel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5720
    "returns my menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5721
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  5722
    ^ menuPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5723
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5724
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5725
nameKey
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5726
    "gets the nameKey"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5727
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5728
    ^ menuItem nameKey
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5729
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5730
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5731
nameKey:aNameKey
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5732
    "sets the nameKey"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5733
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5734
    menuItem nameKey:aNameKey.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5735
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5736
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5737
rawLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5738
    "returns my raw, unprocessed label"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5739
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5740
    ^ menuItem rawLabel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5741
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5742
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5743
shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5744
    "get the key to press to select the submenu from the keyboard or if
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5745
     no submenu exists evaluate the action assigned to the item (accept)."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5746
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5747
    ^ menuItem shortcutKey
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5748
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5749
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5750
shortcutKey:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5751
    "set the key to press to select the submenu from the keyboard or if
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5752
     no submenu exists evaluate the action assigned to the item (accept)."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5753
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5754
    menuItem shortcutKey ~= aKey ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5755
        menuItem shortcutKey:aKey.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5756
        self invalidate.
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  5757
    ].
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  5758
!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5759
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5760
startGroup
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  5761
    "start group #left #right #conditionalRight ... or nil
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  5762
     at the moment only #right and #conditionalRight are implemented"
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5763
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5764
    ^ menuItem startGroup
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  5765
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  5766
    "Modified: / 16-10-2006 / 13:06:25 / cg"
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5767
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5768
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5769
startGroup:aSymbol
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  5770
    "start group #left #right #conditionalRight ...
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  5771
     at the moment only #right and #conditionalRight are implemented"
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5772
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5773
    menuItem startGroup:aSymbol.
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  5774
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  5775
    "Modified: / 16-10-2006 / 13:06:37 / cg"
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5776
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5777
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5778
submenu
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  5779
    "returns my submenu or creates it if its defined via a selector or channel.
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  5780
     May return nil, if there is really no menu"
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  5781
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  5782
    subMenu isNil ifTrue:[
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  5783
        self setupSubmenu
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  5784
    ].
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  5785
    ^ subMenu
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  5786
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  5787
    "Modified: / 07-11-2006 / 11:09:49 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5788
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5789
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5790
submenu:aSubMenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5791
    "set a new submenu; an existing submenu will be destroyed. 
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5792
     This might lead to a redraw if 'hasSubmenu' changed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5793
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5794
    |widget|
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5795
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5796
    aSubMenu isNil ifTrue:[
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5797
        subMenu notNil ifTrue:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5798
            subMenu destroy.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5799
            subMenu := nil.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5800
        ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5801
        ^ self
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5802
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5803
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5804
    (aSubMenu isKindOf:Menu) ifTrue:[
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5805
        subMenu := MenuPanel new.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5806
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5807
        menuPanel notNil ifTrue:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5808
            subMenu receiver:menuPanel receiver.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5809
        ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5810
        subMenu superMenu:menuPanel.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5811
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5812
        menuItem horizontalLayout == true ifTrue:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5813
            subMenu verticalLayout:false
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5814
        ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5815
        subMenu menu:aSubMenu.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5816
    ] ifFalse:[
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5817
        aSubMenu isView ifFalse:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5818
            (aSubMenu isKindOf:ApplicationModel) ifFalse:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5819
                "/ ... mhhhh ....
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5820
                ^ menuItem submenuChannel:aSubMenu
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5821
            ].            
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5822
            widget := SimpleView new.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5823
            widget client:aSubMenu.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5824
        ] ifTrue:[
2827
139c1089bcb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  5825
            widget := aSubMenu.
139c1089bcb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  5826
            subMenu perform:#superMenu: with:menuPanel ifNotUnderstood:[].
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5827
        ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5828
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5829
        (widget isKindOf:MenuPanel) ifTrue:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5830
            subMenu := widget.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5831
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5832
            menuItem horizontalLayout == true ifTrue:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5833
                subMenu verticalLayout:false
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5834
            ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5835
        ] ifFalse:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5836
            subMenu := MenuPanel new.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5837
            subMenu receiver:menuPanel receiver.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5838
            subMenu addSubView:widget.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5839
            subMenu extent:(widget preferredExtent).
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5840
            widget origin:0.0@0.0 corner:1.0@1.0.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5841
        ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5842
        subMenu superMenu:menuPanel.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5843
    ].
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5844
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5845
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  5846
submenuOrNil
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  5847
    "returns my submenu or nil if there is none or its defined via a channel or selector"
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  5848
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  5849
    ^ subMenu
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  5850
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  5851
    "Created: / 07-11-2006 / 11:04:47 / cg"
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  5852
!
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  5853
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5854
textLabel
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5855
    "returns my textLabel or nil.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5856
     Used internally to select items via initial-character, for example."
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5857
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5858
    |txt|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5859
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5860
    displayLabel notNil ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5861
        displayLabel isArray ifFalse:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5862
            ^ displayLabel perform:#string ifNotUnderstood:nil
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5863
        ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5864
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5865
        displayLabel do:[:el|
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5866
            (txt := el perform:#string ifNotUnderstood:nil) notNil ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5867
                ^ txt
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5868
            ]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5869
        ].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5870
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5871
    ^ nil
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5872
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5873
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5874
triggerOnDown
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5875
    "return true if triggering the action if pressed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5876
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5877
    menuItem triggerOnDown ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5878
        self hasSubmenu ifFalse:[^ true].
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5879
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5880
    ^ false
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5881
!
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5882
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5883
triggerOnDown:aBool
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5884
    "setup to trigger the action if pressed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5885
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5886
    menuItem triggerOnDown:aBool.
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5887
!
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5888
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5889
value
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5890
    "gets the items value
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5891
     Left here for ST80 compatibility - value is a bad name"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5892
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5893
    ^ menuItem itemValue
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5894
!
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5895
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5896
value:aValue
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5897
    "could be a value holder, an action or selector
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5898
     Left here for ST80 compatibility - value: is a bad name"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5899
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5900
    menuItem itemValue:aValue.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  5901
!
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  5902
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  5903
value:aValue argument:anArgument
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5904
    "set the value and an argument"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5905
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5906
    menuItem itemValue:aValue.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5907
    menuItem  argument:anArgument.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5908
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5909
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  5910
!MenuPanel::Item methodsFor:'accessing-behavior'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5911
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5912
choice
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5913
    "implements a radio group; the field"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5914
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5915
    ^ choice
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5916
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5917
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5918
choice:something
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5919
    "set choice indication"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5920
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5921
    choice == something ifTrue:[^ self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5922
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5923
    choice isValueModel ifTrue:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5924
        choice removeDependent:self
1726
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
    (choice := something) notNil ifTrue:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5928
        choice isSymbol ifTrue:[
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5929
            (choice := self aspectAt:choice) isNil ifTrue:[
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5930
                choice := something
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5931
            ]
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5932
        ].
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5933
        choice isValueModel ifTrue:[
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5934
            choice addDependent:self
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5935
        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5936
    ].
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5937
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5938
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5939
choiceValue
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5940
    "implements a radio group; the value writen to the choice if selected"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5941
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5942
    ^ menuItem choiceValue
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5943
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5944
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5945
choiceValue:something
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5946
    "implements a radio group; the value writen to the choice if selected"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5947
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5948
    menuItem choiceValue ~= something ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5949
        menuItem choiceValue:something.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5950
        choice notNil ifTrue:[ self invalidate ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5951
    ].
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5952
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5953
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5954
enabled
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5955
    "returns the enabled state"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5956
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5957
    |state|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5958
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5959
    menuPanel enabled ifFalse:[^ false].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5960
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5961
    enableChannel isSymbol ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5962
        state := self aspectAt:enableChannel.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5963
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5964
        state isNil ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5965
            self ifNotInUIBuilderInfoPrintCR:
3414
b0fb84e3e809 more info about missing channel
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  5966
                ('MenuPanel::Item [info]: no aspect for %1 (in %2)' 
b0fb84e3e809 more info about missing channel
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  5967
                    bindWith:enableChannel
b0fb84e3e809 more info about missing channel
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  5968
                    with:label).
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5969
            ^ true
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5970
        ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5971
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5972
        state isValueModel ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5973
            enableChannel := state.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5974
            enableChannel addDependent:self.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5975
            state := enableChannel value.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5976
        ] ifFalse:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5977
            state := state value
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5978
        ]
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5979
    ] ifFalse:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5980
        state := enableChannel value
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5981
    ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5982
    ^ state ~~ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5983
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5984
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5985
enabled:something
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5986
    "change the enabled state; if the state changed, a redraw is performed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5987
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5988
    |oldState newState|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5989
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5990
    enableChannel isNil ifTrue:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5991
        oldState := true
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5992
    ] ifFalse:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5993
        oldState := enableChannel value.
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5994
        enableChannel isValueModel ifTrue:[
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5995
            enableChannel removeDependent:self
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5996
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5997
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5998
    enableChannel := something.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5999
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6000
    enableChannel isNil ifTrue:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6001
        menuPanel shown ifFalse:[^ self].
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6002
        newState := true
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6003
    ] ifFalse:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6004
        enableChannel isValueModel ifTrue:[
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6005
            enableChannel addDependent:self
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6006
        ] ifFalse:[
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6007
            enableChannel isSymbol ifTrue:[^ self]
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6008
        ].
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6009
        menuPanel shown ifFalse:[^ self].
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6010
        newState := enableChannel value.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6011
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6012
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6013
    newState ~~ oldState ifTrue:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6014
        self invalidate
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  6015
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6016
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6017
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  6018
hideMenuOnActivated
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6019
    "hide the menu when the item was activated; the default is true"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6020
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6021
    ^ menuItem hideMenuOnActivated
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  6022
!
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  6023
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  6024
hideMenuOnActivated:aBool
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6025
   "hide the menu when the item was activated; the default is true"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6026
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6027
   menuItem hideMenuOnActivated:aBool.
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  6028
!
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  6029
2216
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6030
ifNotInUIBuilderInfoPrintCR:aMessage
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6031
    "/ q&d hack to suppress info-messages in UIBuilder
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6032
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6033
    (menuPanel receiver isNil
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6034
    and:[ menuPanel application notNil
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6035
    and:[ menuPanel application askFor:#isUIPainter]])
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6036
    ifTrue:[
3414
b0fb84e3e809 more info about missing channel
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  6037
        ^ self "/ suppressed
b0fb84e3e809 more info about missing channel
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  6038
    ].
b0fb84e3e809 more info about missing channel
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  6039
    aMessage infoPrint.
b0fb84e3e809 more info about missing channel
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  6040
    menuPanel application notNil ifTrue:[
b0fb84e3e809 more info about missing channel
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  6041
        menuPanel application infoPrint
b0fb84e3e809 more info about missing channel
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  6042
    ].
3444
b7d2f3fe5055 avoid ultra-long lines in Transcript
Claus Gittinger <cg@exept.de>
parents: 3441
diff changeset
  6043
    '' infoPrintCR.
2216
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6044
!
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6045
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6046
indication
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6047
    "get on/off indication"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6048
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6049
    ^ indication
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6050
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6051
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6052
indication:something
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6053
    "set on/off indication"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6054
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6055
    indication == something ifTrue:[^ self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6056
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6057
    indication isValueModel ifTrue:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6058
        indication removeDependent:self
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6059
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6060
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6061
    (indication := something) notNil ifTrue:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6062
        indication isValueModel ifTrue:[
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6063
            indication addDependent:self
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6064
        ] ifFalse:[
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6065
            "/ to force an update of the value
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6066
            self indicationValue
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6067
        ]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6068
    ].
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  6069
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  6070
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6071
keepLinkedMenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6072
    "get the keepLinkedMenu flag"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6073
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6074
    ^ menuItem keepLinkedMenu
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6075
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6076
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6077
keepLinkedMenu:aBool
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6078
    "get the keepLinkedMenu flag"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6079
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6080
    menuItem keepLinkedMenu:aBool.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6081
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6082
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6083
sendToOriginator
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6084
    "if true, the message is sent to the originating widget;
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6085
     otherwise (the default), it it sent to the receiver/application."
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6086
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6087
    ^ menuItem sendToOriginator
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6088
!
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6089
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6090
sendToOriginator:aBoolean
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6091
    "if true, the message is sent to the originating widget;
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6092
     otherwise (the default), it it sent to the receiver/application."
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6093
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6094
    menuItem sendToOriginator:aBoolean.
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6095
!
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6096
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  6097
submenuChannel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6098
    "get the submenu channel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6099
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6100
    ^ menuItem submenuChannel
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  6101
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  6102
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  6103
submenuChannel:aSelectorOrNil
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6104
    "returns the submenu channel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6105
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6106
    menuItem submenuChannel:aSelectorOrNil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6107
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6108
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  6109
!MenuPanel::Item methodsFor:'accessing-dimension'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6110
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6111
moveBy:aPoint
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6112
    "move the layouts origin"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6113
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6114
    layout moveBy:aPoint.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6115
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6116
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6117
preferredExtent
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6118
    "compute my preferred extent excluding the shortCutKey and the menu identifier"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6119
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6120
    |isVertical icon wIcon isButton labelExtent
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6121
     x "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6122
     y "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6123
     s "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6124
    |
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6125
    self isVisible ifFalse:[^ 0@0 ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6126
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6127
    isButton := menuItem isButton.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6128
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6129
    isButton ifTrue:[
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6130
        s := menuPanel maxAbsoluteButtonLevel.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6131
        x := s + HorizontalButtonInset.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6132
        y := s + VerticalButtonInset.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6133
    ] ifFalse:[
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6134
        x  := HorizontalInset.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6135
        y  := (menuPanel isPopUpView ifTrue:[VerticalPopUpInset] ifFalse:[VerticalInset]) ? 2.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6136
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6137
    x := x * 2.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6138
    y := y * 2.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6139
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6140
    isVertical := menuPanel verticalLayout.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6141
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6142
    self isSeparator ifTrue:[
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6143
        "SEPARATOR"
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6144
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6145
        s := self class separatorSize.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6146
        label = '' ifTrue:[
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6147
            s := self class halfSeparatorSize.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6148
        ].
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6149
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6150
        "width of doubleSeparator is 5 !!!!"
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6151
        isVertical ifFalse:[
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6152
            x := x max:s.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6153
            y := y + 5.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6154
        ] ifTrue:[
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6155
            y := y max:s.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6156
            x := x + 5.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6157
        ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6158
    ] ifFalse:[
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6159
        labelExtent := self displayLabelExtent.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6160
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6161
        x := x + labelExtent x.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6162
        y := y + labelExtent y.
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  6163
        x := x + (menuPanel stringOffsetXfor:self).
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6164
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6165
        isButton ifFalse:[
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6166
            menuPanel showSeparatingLines ifTrue:[
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6167
                "width of separator is 2 plus right offset 1 := 3"
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6168
                isVertical ifFalse:[x := x + 3] ifTrue:[y := y + 3].
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6169
            ].
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6170
        ].
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6171
        wIcon := 0.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6172
        self hasMenuIndicator ifTrue:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6173
            icon := MenuPanel menuIndicator.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6174
            wIcon := MenuPanel menuIndicatorOffset + icon width.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6175
        ] ifFalse:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6176
            self hasDelayedMenuIndicator ifTrue:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6177
                icon := MenuPanel delayedMenuIndicator.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6178
                wIcon := MenuPanel delayedMenuIndicatorOffset + icon width.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6179
            ]
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6180
        ].
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6181
        x := x + wIcon.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6182
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6183
    ^ x@y
3421
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  6184
!
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  6185
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  6186
preferredHeight
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  6187
    ^ self preferredExtent y
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  6188
!
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  6189
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  6190
preferredWidth
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  6191
    ^ self preferredExtent x
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6192
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6193
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  6194
!MenuPanel::Item methodsFor:'accessing-help'!
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6195
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6196
activeHelpKey
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6197
    "get the active helpKey; the key to retrieve the helpText from the application"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6198
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6199
    ^ menuItem activeHelpKey
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6200
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6201
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6202
activeHelpKey:aHelpKey
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6203
    "set the active helpKey; the key to retrieve the helpText from the application"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6204
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6205
    menuItem activeHelpKey:aHelpKey.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6206
    activeHelpText := nil.
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6207
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6208
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6209
activeHelpText
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6210
    "get the active helpText or nil if not yet resolved"
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6211
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6212
    |app key|
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6213
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6214
    activeHelpText notNil ifTrue:[^ activeHelpText].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6215
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6216
    ((key := self activeHelpKey) notNil 
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6217
    and:[(app := menuPanel application) notNil]) ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6218
        ^ app helpTextForKey:key.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6219
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6220
    ^ nil
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6221
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6222
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6223
activeHelpText:aText
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6224
    "set the active helpText"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6225
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6226
    activeHelpText := aText.
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6227
!
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6228
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6229
flyByHelpText
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6230
    "get the flyBy helpText or nil."
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6231
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6232
    |text key app|
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6233
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6234
    flyByHelpText notNil ifTrue:[^ flyByHelpText].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6235
2574
366e5807711f separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2569
diff changeset
  6236
    self isSeparator ifTrue:[^ nil].
366e5807711f separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2569
diff changeset
  6237
2471
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  6238
    "/ its NOT the button-attribute, which controls flyByHelp suppression...
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  6239
    "/ (if you have an argument for that let us know..)
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  6240
    "/    self isButton ifFalse:[^ nil].
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  6241
    (menuPanel isNil or:[menuPanel isPopUpView]) ifTrue:[^ nil].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6242
2652
686c0f0acb90 do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  6243
    "/ if an activeHelpKey was explicitely given, use that one
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6244
    key := self activeHelpKey. 
2895
4e63ee409513 flyByHelpText in Launcher
Claus Gittinger <cg@exept.de>
parents: 2888
diff changeset
  6245
    app := menuPanel application.
4e63ee409513 flyByHelpText in Launcher
Claus Gittinger <cg@exept.de>
parents: 2888
diff changeset
  6246
4e63ee409513 flyByHelpText in Launcher
Claus Gittinger <cg@exept.de>
parents: 2888
diff changeset
  6247
    "/ special hook for menuItems added by other applications (i.e. via addMenuItem to the launcher)
4e63ee409513 flyByHelpText in Launcher
Claus Gittinger <cg@exept.de>
parents: 2888
diff changeset
  6248
    (key isAssociation) ifTrue:[
4e63ee409513 flyByHelpText in Launcher
Claus Gittinger <cg@exept.de>
parents: 2888
diff changeset
  6249
        app := key key.
4e63ee409513 flyByHelpText in Launcher
Claus Gittinger <cg@exept.de>
parents: 2888
diff changeset
  6250
        key := key value.
4e63ee409513 flyByHelpText in Launcher
Claus Gittinger <cg@exept.de>
parents: 2888
diff changeset
  6251
    ].
4e63ee409513 flyByHelpText in Launcher
Claus Gittinger <cg@exept.de>
parents: 2888
diff changeset
  6252
3402
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  6253
    key notNil ifTrue:[
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  6254
        app notNil ifTrue:[
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  6255
            text := app flyByHelpTextForKey:key.
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  6256
        ].
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  6257
        text isNil ifTrue:[
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  6258
            text := menuPanel flyByHelpTextForKey:key.
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  6259
        ].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6260
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6261
2652
686c0f0acb90 do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  6262
    "/ otherwise, construct from the label; but only if I do not have a submenu
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6263
    text isNil ifTrue:[
2676
01dc236c3dcd flyByHelp: shown for items with menu IFF there is an activeHelp key
ca
parents: 2675
diff changeset
  6264
        self hasSubmenu ifTrue:[
01dc236c3dcd flyByHelp: shown for items with menu IFF there is an activeHelp key
ca
parents: 2675
diff changeset
  6265
            ^ key
01dc236c3dcd flyByHelp: shown for items with menu IFF there is an activeHelp key
ca
parents: 2675
diff changeset
  6266
        ].
2652
686c0f0acb90 do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  6267
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6268
        text := key.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6269
        text isNil ifTrue:[
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6270
            displayLabel isString ifTrue:[
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6271
                text := displayLabel string.
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6272
            ].
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6273
        ].
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6274
        text isNil ifTrue:[
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6275
            text := self rawLabel.
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6276
            text isString ifFalse:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6277
                text := menuItem rawLabel.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6278
                text isString ifFalse:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6279
                    text := nil.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6280
                ]
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6281
            ].
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6282
            text notNil ifTrue:[
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6283
                (text includes:$&) ifTrue:[ 
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6284
                    text := (self updateAccessCharacterFor:text) string.
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6285
                ].
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6286
            ].
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6287
        ].
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6288
    ].
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6289
3402
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  6290
    (text isString and:[text isBlank]) ifTrue:[ text := nil ].
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6291
    text = displayLabel ifTrue:[
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6292
        "for text menus: it does not make sense to show the labels string again
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6293
         (i.e. in a pull down menu)"
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6294
        ^ nil
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6295
    ].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6296
    ^ text
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6297
!
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6298
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6299
flyByHelpText:aText
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6300
    "exlicitly set the flyBy helpText. For example, to dynamically change it."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6301
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6302
    flyByHelpText := aText.
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6303
! !
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6304
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6305
!MenuPanel::Item methodsFor:'accessing-look'!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6306
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6307
horizontalLayout
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6308
    "on default submenus has a vertical layout;
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6309
     true, the submenu has a horizontal layout."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6310
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6311
    ^ menuItem horizontalLayout ? false
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6312
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6313
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6314
horizontalLayout:aBoolean
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6315
    "on default submenus has a vertical layout;
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6316
     true, the submenu has a horizontal layout."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6317
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6318
    menuItem horizontalLayout:aBoolean.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6319
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6320
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6321
isButton
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6322
    "returns whether the item looks like a Button"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6323
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6324
    ^ menuItem isButton
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6325
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6326
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6327
isButton:aBool
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6328
    "set/clear the item to look like a Button"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6329
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6330
    menuItem isButton ~~ aBool ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6331
        menuItem isButton:aBool.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6332
        self invalidate.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6333
    ]
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6334
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6335
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6336
layout
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6337
    "returns my layout ( Rectangle )"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6338
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6339
    ^ layout
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6340
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6341
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6342
layout:aLayout
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6343
    "set a new layout ( Rectangle )"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6344
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6345
    layout := aLayout.
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6346
    self invalidate.
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6347
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6348
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6349
showBusyCursorWhilePerforming
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6350
    "get the flag which controls if a busy cursor is to be shown
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6351
     while performing the menu action. Defaults to false."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6352
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6353
    ^ menuItem showBusyCursorWhilePerforming
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6354
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6355
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6356
showBusyCursorWhilePerforming:aBoolean
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6357
    "set/clear the flag which controls if a busy cursor is to be shown
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6358
     while performing the menu action. Defaults to false."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6359
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6360
    menuItem showBusyCursorWhilePerforming:aBoolean.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6361
! !
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6362
2504
0ce78a73aacf method category rename
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
  6363
!MenuPanel::Item methodsFor:'activation & deactivation'!
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  6364
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6365
currentSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6366
    "returns the current submenu or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6367
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6368
    ^ subMenu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6369
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6370
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  6371
hideSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6372
    "hide submenu"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6373
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6374
    self hideSubmenu:subMenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6375
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6376
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6377
hideSubmenu:aSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6378
    "hide submenu"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6379
2871
c74f2a6ff335 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2870
diff changeset
  6380
    |id wg|
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  6381
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  6382
    aSubmenu isNil ifTrue:[^ self].
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6383
    aSubmenu removeDependencies.
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6384
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6385
    aSubmenu realized ifFalse:[
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6386
        id := aSubmenu id.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  6387
        id notNil ifTrue:[ menuPanel device unmapWindow:id ]
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6388
    ] ifTrue:[
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6389
        aSubmenu hide
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6390
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6391
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6392
    aSubmenu windowGroup:nil.
2871
c74f2a6ff335 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2870
diff changeset
  6393
    (wg := menuPanel windowGroup) notNil ifTrue:[
c74f2a6ff335 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2870
diff changeset
  6394
        wg removeView:aSubmenu.
c74f2a6ff335 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2870
diff changeset
  6395
    ].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6396
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6397
    "/ release menu if derived from channel
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6398
    (subMenu == aSubmenu and:[menuItem submenuChannel notNil]) ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6399
        menuItem keepLinkedMenu ifFalse:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6400
            subMenu := nil
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6401
        ]
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6402
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6403
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6404
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6405
openDelayedSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6406
    "called to open now my delayed submenu"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6407
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6408
    |subMenuBeforeOpening|
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6409
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6410
    (self isSelected and:[menuPanel shown]) ifFalse:[^ self].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6411
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  6412
    subMenu notNil ifTrue:[
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  6413
        subMenu realized ifTrue:[
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  6414
            "/ already open
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  6415
            ^ self
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  6416
        ].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6417
    ].
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6418
    self setupSubmenu.
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6419
    subMenu isNil ifTrue:[^ self].
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6420
    subMenuBeforeOpening := subMenu.
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6421
    self openSubmenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6422
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6423
    (subMenuBeforeOpening == subMenu and:[self isSelected]) ifFalse:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  6424
        "/ closed during building or opening the submenu
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6425
        self hideSubmenu:subMenuBeforeOpening.
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6426
    ].
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6427
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6428
    "Modified: / 07-11-2006 / 11:07:57 / cg"
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  6429
!
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6430
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6431
openSubmenu
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6432
    "opens the submenu; make sure, that the submenu and the menPanel
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6433
     is fully visible by shifting it into the visible screen area if
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6434
     nescessary."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6435
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  6436
    |p o device isVertical topMenu windGrp prefExtent lastEvent
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6437
     devBot   "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6438
     devRight "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6439
     width    "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6440
     height   "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6441
     top      "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6442
     left     "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6443
    |
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6444
1737
c18896a7cb50 replace shown by realized; when opening a submenue-submenue by shortcut key
ca
parents: 1735
diff changeset
  6445
    (subMenu notNil and:[subMenu shown not and:[self isSelected and:[menuPanel realized]]]) ifFalse:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6446
        ^ self
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6447
    ].
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6448
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6449
    topMenu := menuPanel topMenu.
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  6450
    (subMenu device notNil and:[topMenu device ~~ subMenu device]) ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6451
        subMenu releaseDeviceResources.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6452
        subMenu setDevice:topMenu device id:nil gcId:nil.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6453
        subMenu recreate.
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  6454
    ].
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  6455
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6456
    windGrp := topMenu windowGroup.
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  6457
    windGrp notNil ifTrue:[
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  6458
        lastEvent := windGrp lastEvent.
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  6459
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  6460
        (lastEvent notNil and:[lastEvent isButtonPressEvent]) ifTrue:[
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  6461
            subMenu mapTime:(lastEvent timeStamp).
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  6462
        ].
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  6463
    ].
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6464
    subMenu superMenu:menuPanel.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6465
    subMenu becomesActiveMenu.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6466
    subMenu cursor:Cursor hand.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6467
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6468
    windGrp notNil ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6469
        subMenu windowGroup:windGrp.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6470
        windGrp addTopView:subMenu.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6471
    ].
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6472
2111
f3d67f7c0f92 bug fix when opening a menu by mnemonic
ca
parents: 2100
diff changeset
  6473
    "Q&D kludge - test whether the layout is nil;
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6474
                  if true recompute the layouts
2111
f3d67f7c0f92 bug fix when opening a menu by mnemonic
ca
parents: 2100
diff changeset
  6475
    "
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  6476
    layout isNil ifTrue:[menuPanel rearrangeItems].
2111
f3d67f7c0f92 bug fix when opening a menu by mnemonic
ca
parents: 2100
diff changeset
  6477
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6478
    " Q&D kludge - if any visibility attributes are blocks;
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6479
      TODO: only invoke mustRearrange if any are blocks
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6480
            (since I react correctly on valueHolder changes)
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6481
    "
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6482
    subMenu rearrangeItemsIfItemVisibilityChanged.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6483
    subMenu fixSize.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6484
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6485
    "compute origin of subMenu
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6486
    "
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6487
    isVertical := menuPanel verticalLayout.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6488
    device     := menuPanel device.
1714
b4c05977e9d5 get heigth and width from preferredExtent when open a submenu
ca
parents: 1710
diff changeset
  6489
    prefExtent := subMenu preferredExtent.
b4c05977e9d5 get heigth and width from preferredExtent when open a submenu
ca
parents: 1710
diff changeset
  6490
    height     := prefExtent y.
b4c05977e9d5 get heigth and width from preferredExtent when open a submenu
ca
parents: 1710
diff changeset
  6491
    width      := prefExtent x.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6492
    devBot     := device  usableHeight.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6493
    devRight   := device  usableWidth.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6494
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6495
    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
  6496
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6497
    menuPanel isPopUpView ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6498
        o := menuPanel origin + p
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6499
    ] ifFalse:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6500
        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
  6501
    ].
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6502
    left := o x.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6503
    top  := o y.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6504
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6505
    top + height > devBot ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6506
        top := isVertical ifTrue:[devBot - height]
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6507
                         ifFalse:[top - layout height - height + 2]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6508
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6509
    top := top max:0.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6510
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6511
"/    (isVertical not and:[subMenu isVerticalLayout]) ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6512
"/        top < menuPanel bottom ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6513
"/            left := left + layout width.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6514
"/        ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6515
"/        left + width > devRight ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6516
"/            left := o x - width - 2
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6517
"/        ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6518
"/    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6519
        
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6520
    left + width > devRight ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6521
        left := isVertical ifTrue:[left - layout width - width + 2]
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6522
                          ifFalse:[devRight - width]
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6523
    ].
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6524
    left := left max:0.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6525
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6526
    subMenu origin:(left@top).
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6527
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6528
    subMenu realized ifFalse:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6529
        subMenu realize. 
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6530
    ] ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6531
        topMenu device mapWindow:(subMenu id).
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6532
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6533
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6534
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6535
toggleSubmenuVisibility
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6536
    "toggle the visibility of the submenu"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6537
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6538
    subMenu notNil ifTrue:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6539
        subMenu shown ifTrue:[^ self hideSubmenu]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6540
    ] ifFalse:[
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6541
        self setupSubmenu.
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6542
        subMenu isNil ifTrue:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6543
            "/ cannot open a submenu
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6544
            ^ self
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6545
        ]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6546
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6547
    self openSubmenu.
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6548
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6549
    "Modified: / 07-11-2006 / 11:06:42 / cg"
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6550
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6551
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6552
visibleSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6553
    "returns the current visible submenu or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6554
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6555
    subMenu notNil ifTrue:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6556
        subMenu shown ifTrue:[^ subMenu].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6557
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6558
    ^ nil
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6559
! !
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6560
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6561
!MenuPanel::Item methodsFor:'building'!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6562
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6563
aspectAt:aKey
3092
a1dee282cab7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  6564
    "returns the value assigned to key or nil"
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6565
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6566
    |appl value|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6567
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6568
    appl := menuPanel receiver.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6569
1219
6a0d677a6fac removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents: 1218
diff changeset
  6570
    (appl isValueModel) ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6571
        ^ appl value:aKey
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6572
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6573
2123
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  6574
    appl isNil ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6575
        appl := menuPanel application.
2123
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  6576
    ].
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  6577
    appl isNil ifTrue:[ ^ nil].
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  6578
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  6579
    MessageNotUnderstood handle:[:ex|
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6580
        ex selector == aKey ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6581
            ex reject
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6582
        ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6583
        self ifNotInUIBuilderInfoPrintCR:
2771
3328da9f3df8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2770
diff changeset
  6584
            ('MenuPanel::Item [info]: application (%1) does not provide aspect: %2' 
3328da9f3df8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2770
diff changeset
  6585
             bindWith:appl classNameWithArticle with:aKey).
2123
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  6586
    ] do:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6587
        aKey numArgs == 1 ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6588
            value := appl perform:aKey with:(menuItem argument ? self).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6589
        ] ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6590
            (appl respondsTo:#aspectFor:) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6591
                value := appl aspectFor:aKey
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6592
            ] ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6593
                value := appl perform:aKey
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6594
            ]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6595
        ]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6596
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6597
    ^ value
1029
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  6598
3092
a1dee282cab7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  6599
    "Modified: / 05-10-2006 / 03:10:20 / cg"
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6600
! !
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6601
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6602
!MenuPanel::Item methodsFor:'change & update'!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6603
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6604
fontChanged
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6605
    "called whenever the font changed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6606
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6607
    displayLabel notNil ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6608
        displayLabelExtent := nil.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6609
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6610
        subMenu notNil ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6611
            subMenu font:(menuPanel font).
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6612
        ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6613
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6614
!
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6615
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6616
update:something with:aParameter from:changedObject
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6617
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6618
    |form rect|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6619
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6620
    (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
  6621
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6622
    self isSeparator ifFalse:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6623
        "/ NOT A SEPARATOR
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6624
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6625
        menuPanel shown ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6626
            changedObject == enableChannel ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6627
                (enableChannel value == false and:[self isSelected]) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6628
                    ^ menuPanel selection:nil.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6629
                ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6630
                ^ self invalidate
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6631
            ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6632
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6633
            (changedObject == indication or:[changedObject == choice]) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6634
                menuItem isButton ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6635
                    self invalidate
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6636
                ] ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6637
                    "/ invalidate the interactor only
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6638
                    "/ take any interactor; interactors has the same extent
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6639
                    form := menuPanel iconIndicationOff.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6640
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6641
                    rect := Rectangle left:(layout left + HorizontalInset)
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6642
                                       top:(layout top)
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6643
                                     width:(form width)
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6644
                                    height:(layout height).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6645
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6646
                    menuPanel invalidate:rect repairNow:false
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6647
                ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6648
                ^ self
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6649
            ].
2855
c7f3481ff14a redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents: 2844
diff changeset
  6650
            self invalidate.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6651
        ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  6652
    ].
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6653
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6654
    changedObject == isVisible ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6655
        menuPanel mustRearrange.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6656
        menuPanel rearrangeItems.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6657
        ^ self.
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6658
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6659
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  6660
    super update:something with:aParameter from:changedObject
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6661
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6662
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6663
updateIndicators
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6664
    "update indicators "
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6665
2934
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  6666
    indication notNil ifTrue:[
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  6667
        (indication isSymbol 
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  6668
        or:[menuItem hideMenuOnActivated not])
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  6669
        ifTrue:[
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  6670
            "indication is a selector;
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  6671
             otherwise no need to redraw, because
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  6672
             a change notification is raised from the model !!!!"
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  6673
            self update:nil with:nil from:indication
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  6674
        ]
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6675
    ]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6676
! !
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6677
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6678
!MenuPanel::Item methodsFor:'converting'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6679
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6680
asMenuItem
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6681
    "convert to a MenuItem"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6682
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6683
    ^ menuItem
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6684
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6685
2827
139c1089bcb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  6686
menuItem
139c1089bcb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  6687
    ^ menuItem
139c1089bcb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  6688
!
139c1089bcb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  6689
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6690
menuItem:aMenuItem
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6691
    "setup attributes from a MenuItem"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6692
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6693
    |lbl|
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6694
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6695
    menuPanel disabledRedrawDo:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6696
        menuItem := aMenuItem.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6697
        menuItem isNil ifTrue:[ menuItem := MenuItem new].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6698
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6699
        label := displayLabel := activeHelpText := nil.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6700
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6701
        self    enabled:(menuItem enabled).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6702
        self indication:(menuItem indication).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6703
        self     choice:(menuItem choice).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6704
        self  isVisible:(menuItem isVisible ? true).
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6705
2855
c7f3481ff14a redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents: 2844
diff changeset
  6706
"/ we should call the resourceRetriever here instead of labelImage
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6707
"/ but ... ??
2855
c7f3481ff14a redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents: 2844
diff changeset
  6708
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6709
        (lbl := menuItem labelImage value) isNil ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6710
            lbl := menuItem rawLabel. "/ avoid translating &'s twice
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6711
        ].
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6712
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6713
        self submenu:(menuItem submenu).
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6714
        self label:lbl.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6715
    ]
1033
9badc22e3d03 oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents: 1032
diff changeset
  6716
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  6717
    "Modified: / 22.8.1998 / 15:34:16 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6718
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6719
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6720
!MenuPanel::Item methodsFor:'dependents access'!
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6721
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6722
addDependencies
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6723
    "add all dependencies"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6724
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6725
    enableChannel isValueModel ifTrue:[enableChannel addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6726
    isVisible     isValueModel ifTrue:[isVisible     addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6727
    indication    isValueModel ifTrue:[indication    addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6728
    choice        isValueModel ifTrue:[choice        addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6729
!
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6730
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6731
removeDependencies
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6732
    "remove all dependencies"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6733
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6734
    enableChannel isValueModel ifTrue:[enableChannel removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6735
    isVisible     isValueModel ifTrue:[isVisible     removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6736
    indication    isValueModel ifTrue:[indication    removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6737
    choice        isValueModel ifTrue:[choice        removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6738
! !
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6739
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6740
!MenuPanel::Item methodsFor:'drawing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6741
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  6742
choiceForm
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6743
    "returns choice form or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6744
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  6745
    |isOn|
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  6746
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  6747
    choice isNil ifTrue:[^ nil].
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  6748
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  6749
    isOn := (choice value = menuItem choiceValue).
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  6750
    self enabled ifFalse:[
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  6751
        ^ isOn ifTrue:[menuPanel iconRadioGroupDisabledOn]
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  6752
               ifFalse:[menuPanel iconRadioGroupDisabledOff]
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  6753
    ].
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  6754
    self isSelected ifTrue:[
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  6755
        ^ isOn == true 
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  6756
            ifTrue:[menuPanel iconRadioGroupEnteredOn]
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  6757
            ifFalse:[menuPanel iconRadioGroupEnteredOff]
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  6758
    ].
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  6759
    ^ isOn ifTrue:[menuPanel iconRadioGroupOn]
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  6760
           ifFalse:[menuPanel iconRadioGroupOff]
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  6761
!
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  6762
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6763
draw
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6764
    "redraw this item"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6765
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6766
    |isSelected ownBgCol paint bgColor
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6767
     x  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6768
     y  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6769
     w  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6770
     h  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6771
    |
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6772
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6773
    self isVisible ifFalse:[^ self].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6774
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6775
    self isSeparator ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6776
        self drawSeparator.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6777
        ^ self
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6778
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6779
    menuItem isButton ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6780
        self drawButton.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6781
        ^ self
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6782
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6783
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6784
    "/ DRAW A LABELED ENTRY; no button, no separator
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6785
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6786
    isSelected := self isSelected.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6787
    bgColor    := menuPanel backgroundColor.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6788
    paint      := isSelected 
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6789
                    ifTrue:[self activeBackgroundColor] 
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6790
                    ifFalse:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6791
                        (self isEnabled and:[ self isEntered ]) ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6792
                            menuPanel enteredBackgroundColor
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6793
                        ] ifFalse:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6794
                            bgColor
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6795
                        ]].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6796
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6797
    (ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6798
        paint := ownBgCol
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6799
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6800
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6801
    paint ~= bgColor ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6802
        menuPanel paint:paint.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6803
        menuPanel fillRectangle:layout.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6804
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6805
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6806
    menuPanel showSeparatingLines ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6807
        self drawSeparatingLines
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6808
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6809
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6810
    self drawLabel.  
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6811
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6812
    (ownBgCol notNil and:[isSelected]) ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6813
        ownBgCol brightness > 0.5 ifTrue:[menuPanel paint: menuPanel selectionFrameDarkColor]
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6814
                                 ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6815
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6816
        x := layout left.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6817
        y := layout top.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6818
        w := layout width.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6819
        h := layout height.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6820
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6821
        menuPanel displayRectangleX:(x + 1) y:(y + 1) width:(w - 2) height:(h - 2).
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6822
        menuPanel displayRectangleX:(x + 2) y:(y + 2) width:(w - 4) height:(h - 4).  
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6823
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6824
    menuPanel drawLabelEdgeFor:self selected:isSelected.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6825
!
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6826
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6827
drawButton
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6828
    "draw as button"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6829
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6830
    |drawObject fg etchFg level isEnabled isSelected bg ownBgCol showSelected
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6831
     x "{ Class:SmallInteger }"
2143
7b99a7348c97 draw label shifted right-down when pressed
penk
parents: 2142
diff changeset
  6832
     y "{ Class:SmallInteger }"
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6833
    |
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6834
    drawObject := displayLabel.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6835
    isEnabled  := self enabled.
2159
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  6836
    isSelected := self isSelected.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6837
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6838
    isSelected ifFalse:[
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6839
        "/ test whether button has pressed toggle behaviour
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6840
        showSelected := (self isToggle and:[self indicationValue]).
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6841
    ] ifTrue:[
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6842
        showSelected := isSelected
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6843
    ].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6844
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6845
    showSelected ifTrue:[
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6846
        bg := self activeBackgroundColor.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6847
        fg := self activeForegroundColor.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6848
    ] ifFalse:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6849
        self isEntered ifTrue:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6850
            bg := self buttonEnteredBackgroundColor
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6851
        ] ifFalse:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6852
            bg := self backgroundColor
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6853
        ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6854
        isEnabled ifTrue:[
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6855
            fg := menuPanel foregroundColor
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6856
        ] ifFalse:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6857
            fg := menuPanel disabledForegroundColor.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6858
            etchFg := menuPanel disabledEtchedForegroundColor.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6859
            drawObject := self disabledRawLabel
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6860
        ]
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6861
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6862
1708
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  6863
    (ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  6864
        bg := ownBgCol
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  6865
    ].
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  6866
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6867
    "DRAW BACKGROUND"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6868
    bg ~= menuPanel backgroundColor ifTrue:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6869
        menuPanel paint:bg.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6870
        menuPanel fillRectangle:layout.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6871
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6872
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6873
    x := layout left + menuPanel buttonPassiveLevel + HorizontalButtonInset.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6874
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6875
    (drawObject isImage and:[menuPanel centerItems]) ifTrue:[
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  6876
        x := x + (layout width - menuPanel buttonPassiveLevel - HorizontalButtonInset - 1 - drawObject width // 2).
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  6877
    ].
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6878
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6879
    isSelected ifFalse:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6880
        "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
  6881
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6882
        indication notNil ifTrue:[
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6883
            "button is indicator and set"
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6884
            isSelected := self indicationValue
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6885
        ] ifFalse:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6886
            isSelected := (choice notNil and:[choice value = menuItem choiceValue]).
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6887
        ]
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6888
    ].
2143
7b99a7348c97 draw label shifted right-down when pressed
penk
parents: 2142
diff changeset
  6889
    y := 0.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6890
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6891
    isSelected ifTrue:[   
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6892
        level := menuPanel buttonActiveLevel.
2142
ea2a32738005 pressed button label only shifted by one pixel
penk
parents: 2141
diff changeset
  6893
        x     := x + 1 "level abs".
2143
7b99a7348c97 draw label shifted right-down when pressed
penk
parents: 2142
diff changeset
  6894
        y     := y + 1 "level abs".
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6895
    ] ifFalse:[   
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6896
        level := self isEntered ifTrue:[menuPanel buttonEnteredLevel]
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6897
                               ifFalse:[menuPanel buttonPassiveLevel].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6898
    ].
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6899
2817
805bb3b2ef28 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2793
diff changeset
  6900
    drawObject notEmptyOrNil ifTrue:[
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6901
        etchFg notNil ifTrue:[
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6902
            self drawRawLabel:drawObject atX:x+1 yOffset:y+1 paint:etchFg.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6903
        ].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6904
        self drawRawLabel:drawObject atX:x yOffset:y+0 paint:fg.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6905
    ].
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6906
    self drawMenuIndicator.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6907
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6908
    level ~~ 0 ifTrue:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6909
        menuPanel drawButtonEdgesFor:self level:level
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6910
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6911
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6912
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6913
drawLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6914
    "draw a labeled entry; no button, no separator."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6915
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6916
    |scKey cLb cLa drawObject fg etchFg arrow 
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6917
     isSelected isEnabled form
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6918
     h "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6919
     y "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6920
     x "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6921
     t "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6922
    |
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6923
    drawObject := displayLabel.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6924
    isEnabled  := self enabled.
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6925
    isSelected := self isSelected.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6926
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6927
    isSelected ifTrue:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6928
        fg := self activeForegroundColor
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6929
    ] ifFalse:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6930
        isEnabled ifTrue:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6931
            self isEntered ifTrue:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6932
                fg := menuPanel enteredForegroundColor
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6933
            ] ifFalse:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6934
                fg := menuPanel foregroundColor
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6935
            ]
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6936
        ] ifFalse:[
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6937
            fg          := menuPanel disabledForegroundColor.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6938
            etchFg      := menuPanel disabledEtchedForegroundColor.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6939
            drawObject  := self disabledRawLabel
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6940
        ]
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6941
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6942
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6943
    h := layout height.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6944
    x := layout left + HorizontalInset.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6945
    t := layout top.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6946
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  6947
    (    (form := self indicatorForm) notNil
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  6948
     or:[(form := self choiceForm) notNil]
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  6949
    ) ifTrue:[
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6950
        y := t + ((h - form height) // 2).
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6951
        form displayOn:menuPanel x:x y:y.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6952
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6953
2817
805bb3b2ef28 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2793
diff changeset
  6954
    drawObject notEmptyOrNil ifTrue:[
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  6955
        x := x + (menuPanel stringOffsetXfor:self).
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  6956
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6957
        etchFg notNil ifTrue:[
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6958
            self drawRawLabel:drawObject atX:x+1 yOffset:1 paint:etchFg.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6959
        ].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6960
        self drawRawLabel:drawObject atX:x yOffset:0 paint:fg.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6961
    ].
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6962
    self drawMenuIndicator.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6963
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6964
    "/ DRAW SHORTCUT KEY
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6965
    (     menuItem shortcutKey notNil
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6966
     and:[(x := menuPanel shortKeyInset) ~~ 0
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6967
     and:[(scKey:= self shortcutKeyAsString) notNil]]
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6968
    ) ifTrue:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6969
        x := layout left + x.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6970
        y := t + ((h - (scKey heightOn:menuPanel)) // 2).
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6971
        y := y + menuPanel font ascent.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6972
        scKey displayOn:menuPanel x:x y:y. 
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6973
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6974
3403
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  6975
    "/ DRAW SUBMENU INDICATION (if a vertical menu with submenu)
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  6976
    (menuPanel isVerticalLayout and:[self hasSubmenu]) ifTrue:[
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  6977
        arrow := menuPanel rightArrow.
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  6978
        x := layout right - arrow width - HorizontalInset.
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  6979
        y := t + ((h - arrow height) // 2).
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  6980
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  6981
        (menuPanel styleSheet is3D not
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  6982
        or:[(drawObject := menuPanel rightArrowShadow) isNil]) ifTrue:[
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  6983
            menuPanel displayForm:arrow x:x y:y.
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  6984
        ] ifFalse:[
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  6985
            cLa := menuPanel shadowColor.
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  6986
            cLb := menuPanel lightColor.
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  6987
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  6988
            isSelected ifFalse:[
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  6989
                fg  := cLa.
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  6990
                cLa := cLb.
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  6991
                cLb := fg
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  6992
            ].
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  6993
            menuPanel paint:cLa.
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  6994
            menuPanel displayForm:arrow x:x y:y.
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  6995
            menuPanel paint:cLb.
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  6996
            menuPanel displayForm:drawObject x:x y:y. 
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  6997
        ].
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  6998
    ].
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6999
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7000
    "Modified: / 6.9.1998 / 21:48:53 / cg"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7001
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7002
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7003
drawMenuIndicator
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7004
    "draw a menu indicator if the item has a menu or delayed menu."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7005
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7006
    |x y icon bAbsLevel verticalPosition|
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7007
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7008
    icon := self menuIndicatorIcon.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7009
    icon isNil ifTrue:[
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7010
        ^ self
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7011
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7012
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7013
    x := layout right  - icon width.
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7014
    verticalPosition := menuPanel menuIndicatorVerticalPosition.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7015
    verticalPosition == #center ifTrue:[
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7016
        y := (layout height - icon height) // 2 + layout top.
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7017
    ] ifFalse:[
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7018
        verticalPosition == #top ifTrue:[
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7019
            y := layout top + 2.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7020
        ] ifFalse:[
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7021
            y := layout bottom - icon height - 2.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7022
        ]
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7023
    ].
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7024
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7025
    bAbsLevel := 0.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7026
    menuItem isButton ifTrue:[
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7027
        self isSelected ifTrue:[
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7028
            x := x + 1.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7029
            y := y + 1.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7030
        ].
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7031
        bAbsLevel := menuPanel maxAbsoluteButtonLevel.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7032
        x := x - bAbsLevel.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7033
        y := y - bAbsLevel.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7034
    ].
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7035
    x := x - 1 "- HorizontalInset".
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7036
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7037
    (self isEnabled "and:[self delayedMenuIsEnabled]") ifFalse:[
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7038
        icon := menuPanel lightenedImageOnDevice:icon
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7039
    ].
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7040
    icon displayOn:menuPanel x:x y:y.
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7041
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7042
    (menuPanel drawMenuIndicatorSeparatorLine
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7043
        and:[ self isEntered
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7044
        and:[ menuPanel buttonEnteredLevel ~~ 0] ])
2761
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  7045
    ifTrue:[               
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7046
        menuPanel paint:menuPanel buttonShadowColor.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7047
        menuPanel displayLineFromX:x-2 y:layout top+bAbsLevel+1 toX:x-2 y:layout bottom-bAbsLevel-2.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7048
        menuPanel paint:menuPanel buttonLightColor.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7049
        menuPanel displayLineFromX:x-1 y:layout top+bAbsLevel+1 toX:x-1 y:layout bottom-bAbsLevel-2.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7050
    ].
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7051
!
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7052
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7053
drawRawLabel:aLabel atX:x yOffset:yOffset paint:fg
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7054
    "draw a labeled entry; no button, no separator."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7055
3486
c54b6691e60e variable naming
Stefan Vogel <sv@exept.de>
parents: 3457
diff changeset
  7056
    |oldFont labelExtent
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  7057
     y  "{ Class:SmallInteger }"
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7058
     y0 "{ Class:SmallInteger }"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7059
     x0 "{ Class:SmallInteger }"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7060
    |
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7061
3486
c54b6691e60e variable naming
Stefan Vogel <sv@exept.de>
parents: 3457
diff changeset
  7062
    oldFont := menuPanel setFont:(self font).
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7063
    "/ fontAscent := menuPanel font ascent.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7064
    menuPanel paint:fg.
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7065
    labelExtent := self displayLabelExtent.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7066
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7067
    y := layout top + (layout height - labelExtent y // 2) + yOffset.
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  7068
"/  menuPanel centerItems ifTrue:[self halt].
3454
baefcb629718 Remove string specific acent handling instead of the generic #ascentOn: approach.
Stefan Vogel <sv@exept.de>
parents: 3447
diff changeset
  7069
    aLabel isArray ifFalse:[ 
baefcb629718 Remove string specific acent handling instead of the generic #ascentOn: approach.
Stefan Vogel <sv@exept.de>
parents: 3447
diff changeset
  7070
        |printLabel|
baefcb629718 Remove string specific acent handling instead of the generic #ascentOn: approach.
Stefan Vogel <sv@exept.de>
parents: 3447
diff changeset
  7071
2675
7a090a030736 bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents: 2659
diff changeset
  7072
        aLabel isText ifTrue:[
3454
baefcb629718 Remove string specific acent handling instead of the generic #ascentOn: approach.
Stefan Vogel <sv@exept.de>
parents: 3447
diff changeset
  7073
            "/ background of label has already been drawn
2675
7a090a030736 bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents: 2659
diff changeset
  7074
            printLabel := aLabel withoutEmphasis:#backgroundColor.
7a090a030736 bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents: 2659
diff changeset
  7075
        ] ifFalse:[
7a090a030736 bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents: 2659
diff changeset
  7076
            printLabel := aLabel.
7a090a030736 bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents: 2659
diff changeset
  7077
        ].
3454
baefcb629718 Remove string specific acent handling instead of the generic #ascentOn: approach.
Stefan Vogel <sv@exept.de>
parents: 3447
diff changeset
  7078
        y := y + (printLabel ascentOn:menuPanel).
2675
7a090a030736 bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents: 2659
diff changeset
  7079
        printLabel displayOn:menuPanel x:x y:y.
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  7080
    ] ifTrue:[
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  7081
        aLabel do:[:el|
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  7082
            el notNil ifTrue:[
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7083
                y0 := y + (el ascentOn:menuPanel).
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7084
"/                el isImageOrForm ifFalse:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7085
"/                    y0 := y + fontAscent
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7086
"/                ] ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7087
"/                    y0 := y
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7088
"/                ].
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7089
                x0 := x + (labelExtent x - (el widthOn:menuPanel) // 2).
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  7090
                el displayOn:menuPanel x:x0 y:y0.
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  7091
                y := y + 1 + (el heightOn:menuPanel)
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  7092
            ] ifFalse:[
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7093
                y := y + (self spaceBetweenEmptyLines) 
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  7094
            ]
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  7095
        ].
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  7096
    ].
3486
c54b6691e60e variable naming
Stefan Vogel <sv@exept.de>
parents: 3457
diff changeset
  7097
    menuPanel setFont:oldFont
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7098
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7099
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7100
drawSeparatingLines
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7101
    "draw separating lines"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7102
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7103
    |myIndex lfSep rtSep items prevItem nextItem
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7104
     lightColor shadowColor
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7105
     l "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7106
     t "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7107
     r "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7108
     b "{ Class:SmallInteger }"
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  7109
    |
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7110
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7111
    items := menuPanel items.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7112
    myIndex := items identityIndexOf:self.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7113
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7114
    prevItem  := items at:(myIndex - 1) ifAbsent:nil.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7115
    lfSep := prevItem notNil and:[prevItem isButton not].
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7116
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7117
    nextItem  := items at:(myIndex + 1) ifAbsent:nil.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7118
    rtSep := nextItem notNil and:[nextItem isButton not].
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7119
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7120
    (lfSep or:[rtSep]) ifFalse:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7121
        ^ self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7122
    ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7123
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7124
    lightColor := menuPanel lightColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7125
    shadowColor := menuPanel shadowColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7126
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7127
    menuPanel paint:lightColor.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7128
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7129
    l := layout left.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7130
    t := layout top.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7131
    r := layout right.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7132
    b := layout bottom.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7133
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7134
    menuPanel verticalLayout ifTrue:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7135
        lfSep ifTrue:[menuPanel displayLineFromX:l y:t-1 toX:r y:t-1].
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7136
        rtSep ifTrue:[menuPanel displayLineFromX:l y:b-1 toX:r y:b-1].
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7137
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7138
        menuPanel paint:shadowColor.
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7139
        lfSep ifTrue:[menuPanel displayLineFromX:l y:t-2 toX:r y:t-2].
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7140
        rtSep ifTrue:[menuPanel displayLineFromX:l y:b-2 toX:r y:b-2].
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7141
    ] ifFalse:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7142
        lfSep ifTrue:[menuPanel displayLineFromX:l-1 y:t toX:l-1 y:b].
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7143
        rtSep ifTrue:[menuPanel displayLineFromX:r-1 y:t toX:r-1 y:b].
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7144
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7145
        menuPanel paint:shadowColor.
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7146
        lfSep ifTrue:[menuPanel displayLineFromX:l-2 y:t toX:l-2 y:b].
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7147
        rtSep ifTrue:[menuPanel displayLineFromX:r-2 y:t toX:r-2 y:b]. 
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7148
    ]
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7149
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7150
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7151
drawSeparator
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7152
    "draw as separator"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7153
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7154
    |type lightColor shadowColor isDouble
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7155
     left top
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7156
     x0  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7157
     x1  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7158
     y0  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7159
     y1  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7160
    |
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7161
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7162
    type := self separatorType.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7163
    (type isNil or:[type == #blankLine]) ifTrue:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7164
        ^ self
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7165
    ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7166
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7167
    isDouble := type == #doubleLine.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7168
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7169
    lightColor := menuPanel lightColor.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7170
    shadowColor := menuPanel shadowColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7171
    menuPanel paint:shadowColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7172
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7173
    left := layout left.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7174
    top := layout top.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7175
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7176
    menuPanel verticalLayout ifTrue:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7177
        x0 := left  + HorizontalInset.
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7178
        x1 := layout right - HorizontalInset.
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7179
        y0 := top   - 1 + (layout height // 2).
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7180
        isDouble ifTrue:[y0 := y0 - 2].
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7181
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7182
        menuPanel displayLineFromX:x0 y:y0   toX:x1 y:y0.
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7183
        isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+4 toX:x1 y:y0+4].
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7184
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7185
        menuPanel paint:lightColor.
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7186
        menuPanel displayLineFromX:x0 y:y0+1 toX:x1 y:y0+1.
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7187
        isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+5 toX:x1 y:y0+5].
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7188
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7189
    ] ifFalse:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7190
        y1 := layout bottom.
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7191
        x0 := left - 1 + (layout width // 2).
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7192
        y0 := top.
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7193
        isDouble ifTrue:[x0 := x0 - 2].
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7194
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7195
        menuPanel displayLineFromX:x0   y:y0 toX:x0   y:y1.
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7196
        isDouble ifTrue:[menuPanel displayLineFromX:x0+4 y:y0 toX:x0+4 y:y1].
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7197
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7198
        menuPanel paint:lightColor.
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7199
        menuPanel displayLineFromX:x0+1 y:y0 toX:x0+1 y:y1.
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7200
        isDouble ifTrue:[menuPanel displayLineFromX:x0+5 y:y0 toX:x0+5 y:y1].
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7201
    ]
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7202
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7203
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7204
indicatorForm
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7205
    "returns indication form or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7206
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7207
    |isOn|
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7208
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7209
    indication isNil ifTrue:[^ nil].
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7210
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7211
    isOn := self indicationValue.
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7212
    self enabled ifFalse:[
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7213
        ^ isOn == true 
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7214
            ifTrue:[menuPanel iconIndicationDisabledOn]
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7215
            ifFalse:[menuPanel iconIndicationDisabledOff]
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7216
    ].
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7217
"/    self isSelected ifTrue:[
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7218
"/        ^ isOn == true 
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7219
"/            ifTrue:[menuPanel iconIndicationEnteredOn]
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7220
"/            ifFalse:[menuPanel iconIndicationEnteredOff]
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7221
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7222
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7223
    ^ isOn == true 
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7224
        ifTrue:[menuPanel iconIndicationOn]
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7225
        ifFalse:[menuPanel iconIndicationOff]
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7226
!
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7227
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7228
invalidate
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7229
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7230
    layout isNil ifTrue:[^ self].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7231
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7232
    (displayLabel notNil and:[menuPanel notNil]) ifTrue:[
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7233
        menuPanel invalidateItem:self repairNow:false
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7234
    ]
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7235
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7236
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7237
menuIndicatorIcon
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7238
    "return a menu indicator icon used if the item has a menu or delayed menu."
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7239
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7240
    self hasDelayedMenuIndicator ifTrue:[
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7241
        ^ MenuPanel delayedMenuIndicator.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7242
    ].
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7243
    self hasMenuIndicator ifTrue:[
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7244
        ^ MenuPanel menuIndicator.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7245
    ].
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7246
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7247
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7248
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7249
!MenuPanel::Item methodsFor:'initialization'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7250
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7251
destroy
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7252
    "destroy submenus, remove dependencies"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7253
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  7254
    self submenu:nil.
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7255
    self removeDependencies.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  7256
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7257
    menuPanel := nil.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  7258
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  7259
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7260
in:aPanel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7261
    "create item in a menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7262
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7263
    menuPanel := aPanel.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7264
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7265
    menuItem isNil ifTrue:[
3561
c1db3c0aab04 halt removed
Claus Gittinger <cg@exept.de>
parents: 3558
diff changeset
  7266
        self breakPoint:#ca.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7267
        menuItem := MenuItem new
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7268
    ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7269
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7270
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7271
initialize
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7272
    menuItem := MenuItem new.
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7273
!
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7274
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7275
reinitStyle
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7276
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7277
    subMenu notNil ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  7278
	subMenu reinitStyle
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7279
    ].
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7280
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7281
    "Created: / 17.8.2000 / 17:57:07 / cg"
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7282
    "Modified: / 17.8.2000 / 18:00:08 / cg"
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7283
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7284
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7285
!MenuPanel::Item methodsFor:'label basics'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7286
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7287
disabledRawLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7288
    "returns the label used if the item is disabled"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7289
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7290
    |block form image|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7291
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7292
    disabledDisplayLabel notNil ifTrue:[^ disabledDisplayLabel].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7293
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7294
    disabledDisplayLabel := displayLabel ? ''.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7295
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7296
    disabledDisplayLabel isString ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7297
        ^ disabledDisplayLabel
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7298
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7299
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7300
    block := [:el| |rslt|
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7301
        (rslt := el) notNil ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7302
            el isImageOrForm ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7303
                el colorMap notNil ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7304
                    rslt := menuPanel lightenedImageOnDevice:el
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7305
                ]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7306
            ] ifFalse:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7307
                (displayLabel isKindOf:LabelAndIcon) ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7308
                    ((form := el icon) notNil and:[form colorMap notNil]) ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7309
                        form := menuPanel lightenedImageOnDevice:form
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7310
                    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7311
                    ((image := el image) notNil and:[image colorMap notNil]) ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7312
                        image := menuPanel lightenedImageOnDevice:image
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7313
                    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7314
                    rslt := LabelAndIcon form:form image:image string:(el string).
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7315
                ]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7316
            ]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7317
        ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7318
        rslt
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7319
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7320
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7321
    displayLabel isArray ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7322
        disabledDisplayLabel := Array new:(displayLabel size).
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7323
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7324
        displayLabel keysAndValuesDo:[:anIndex :aLabel|
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7325
            disabledDisplayLabel at:anIndex put:(block value:aLabel)
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7326
        ]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7327
    ] ifFalse:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7328
        disabledDisplayLabel := block value:displayLabel
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7329
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7330
    ^ disabledDisplayLabel
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7331
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7332
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  7333
fetchDeviceResources
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  7334
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7335
    disabledDisplayLabel := nil.
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  7336
    self fetchImages.
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  7337
!
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  7338
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  7339
fetchImages
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7340
    "fetch my icon images"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7341
2118
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  7342
    |icon|
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  7343
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7344
    (displayLabel isNil or:[displayLabel isString]) ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7345
        ^ self
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7346
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7347
    displayLabel isImageOrForm ifTrue:[
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  7348
        displayLabel := menuPanel imageOnMyDevice:displayLabel.
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7349
        ^ self.  
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7350
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7351
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7352
    (displayLabel isKindOf:LabelAndIcon) ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7353
        (icon := displayLabel image) notNil ifTrue:[
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  7354
            displayLabel image:(menuPanel imageOnMyDevice:icon)
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7355
        ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7356
        (icon := displayLabel icon) notNil ifTrue:[
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  7357
            displayLabel icon:(menuPanel imageOnMyDevice:icon)
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7358
        ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7359
        ^ self
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7360
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7361
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7362
    displayLabel isArray ifFalse:[^ self].            
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7363
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7364
    displayLabel keysAndValuesDo:[:i :el|
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7365
        (el notNil and:[el isString not]) ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7366
            el isImageOrForm ifTrue:[
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  7367
                displayLabel at:i put:(menuPanel imageOnMyDevice:el).
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7368
            ] ifFalse:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7369
                el class == LabelAndIcon ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7370
                    (icon := el image) notNil ifTrue:[
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  7371
                        el image:(menuPanel imageOnMyDevice:icon)
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7372
                    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7373
                    (icon := el icon) notNil ifTrue:[
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  7374
                        el icon:(menuPanel imageOnMyDevice:icon)
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7375
                    ]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7376
                ]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7377
            ]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7378
        ]
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  7379
    ].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7380
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7381
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7382
updateAccessCharacterFor:aLabel
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  7383
    "replace the & by the short-key attribute (i.e. underline it)"
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  7384
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7385
    |s i rest label pos|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7386
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  7387
    accessCharacter notNil ifTrue:[^ aLabel].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7388
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7389
    aLabel isString ifFalse:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7390
        aLabel class == LabelAndIcon ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7391
            aLabel string:(self updateAccessCharacterFor:(aLabel string))
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7392
        ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7393
        ^ aLabel
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7394
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7395
    s := aLabel size.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7396
    i := 1.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7397
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7398
    label := aLabel.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7399
    pos := menuItem accessCharacterPosition.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7400
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7401
    [((i := label indexOf:$& startingAt:i) ~~ 0 and:[i < s])] whileTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7402
        rest := label copyFrom:(i+1).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7403
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7404
        i == 1 ifTrue:[label := rest]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7405
              ifFalse:[label := (label copyFrom:1 to:(i-1)), rest].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7406
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7407
        (label at:i) == $& ifTrue:[i := i + 1] ifFalse:[pos := i].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7408
        s := s - 1.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7409
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7410
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7411
    (pos isNil or:[(accessCharacter := label at:pos ifAbsent:nil) isNil]) ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7412
        ^ label
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7413
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7414
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7415
    label isText ifFalse:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7416
        label := Text string:label
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7417
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7418
    label emphasisAt:pos add:#underline.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7419
    ^ label
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7420
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7421
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  7422
!MenuPanel::Item methodsFor:'printing & storing'!
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  7423
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  7424
displayString
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  7425
    ^ self class name, '[', label printString, ']'
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  7426
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  7427
! !
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  7428
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7429
!MenuPanel::Item methodsFor:'private'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7430
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  7431
activeBackgroundColor
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7432
    "returns the active background color derived from menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7433
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7434
    menuItem isButton ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7435
        ^ menuPanel buttonActiveBackgroundColor
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7436
    ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7437
    ^ menuPanel activeBackgroundColor
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  7438
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  7439
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  7440
activeForegroundColor
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7441
    "returns the active foreground color derived from menuPanel"
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  7442
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  7443
    menuItem isButton ifTrue:[
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  7444
        ^ menuPanel buttonActiveForegroundColor
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  7445
    ].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  7446
    ^menuPanel activeForegroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  7447
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  7448
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  7449
backgroundColor
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7450
    "returns the background color derived from menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7451
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7452
    menuItem isButton ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7453
        ^ menuPanel buttonPassiveBackgroundColor
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7454
    ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7455
    ^ menuPanel backgroundColor
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  7456
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  7457
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7458
backgroundColorFromLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7459
    "returns the background color derived from label or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7460
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7461
    |run|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7462
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7463
    label isText ifFalse:[^ nil ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7464
    run := label emphasis.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7465
    run size == 0 ifTrue:[^ nil ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7466
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7467
    run := run first.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7468
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7469
    run size == 0 ifTrue:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7470
        (run value isColor and:[run key == #backgroundColor]) ifTrue:[
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7471
            ^ run value
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7472
        ]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7473
    ] ifFalse:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7474
        run do:[:r|
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7475
            (r value isColor and:[r key == #backgroundColor]) ifTrue:[
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7476
                ^ r value
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7477
            ]
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7478
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7479
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7480
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7481
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7482
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  7483
buttonEnteredBackgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  7484
    "returns the background color to use when thhe mouse has entered 
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7485
     derived from menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7486
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7487
    menuItem isButton ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7488
        ^ menuPanel buttonEnteredBackgroundColor
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7489
    ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  7490
    ^ menuPanel backgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  7491
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  7492
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  7493
findSubMenuIn:aRecv
1051
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  7494
    "ask the receiver for a submenu aspect, sending it
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  7495
     #aspectFor: first; then trying the selector itself.
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  7496
     Ignore the error if that message is not understood
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  7497
     (but not other message-not-understoods)"
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  7498
2069
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  7499
    |subm sel numArgs|
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  7500
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  7501
    aRecv isNil ifTrue:[^ nil].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  7502
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7503
    sel := menuItem submenuChannel.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7504
    sel isString ifFalse:[^ nil].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7505
    sel := sel asSymbol.
2069
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  7506
    numArgs := sel numArgs.
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  7507
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  7508
    numArgs == 0 ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7509
        MessageNotUnderstood handle:[:ex |
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7510
            |selector|
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7511
2737
b0daaddb418b Use MessageNotUnderstood>>#selector
Stefan Vogel <sv@exept.de>
parents: 2736
diff changeset
  7512
            ((selector := ex selector) == sel
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7513
            or:[selector == #aspectFor:]) ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7514
                ex reject
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7515
            ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7516
        ] do:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7517
            subm := aRecv aspectFor:sel.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7518
        ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7519
        subm notNil ifTrue:[^ subm].
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  7520
    ].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  7521
2043
133a9674bcdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  7522
    (Array with:(aRecv) with:(aRecv class))
133a9674bcdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  7523
    do:[:aPossibleReceiver |
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7524
        MessageNotUnderstood handle:[:ex|
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7525
            ex message selector == sel ifFalse:[ ex reject ]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7526
        ] do:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7527
            numArgs == 0 ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7528
                subm := aPossibleReceiver perform:sel
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7529
            ] ifFalse:[ 
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7530
                numArgs == 1 ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7531
                    subm := aPossibleReceiver perform:sel with:(menuItem argument ? menuPanel)
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7532
                ] ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7533
                    subm := aPossibleReceiver perform:sel with:(menuItem argument) with:menuPanel
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7534
                ]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7535
            ]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7536
        ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7537
        subm notNil ifTrue:[^ subm].
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  7538
    ].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  7539
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  7540
    ^ subm
2043
133a9674bcdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  7541
133a9674bcdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  7542
    "Modified: / 30.10.2001 / 13:28:25 / cg"
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  7543
!
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  7544
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7545
indicationValue
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7546
    "returns indication value or nil in case of no indication"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7547
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7548
    |numArgs sel recv|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7549
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7550
    indication isNil ifTrue:[^ nil].                                    "no indication specified"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7551
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7552
    indication isSymbol ifFalse:[                                       
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7553
        ^ indication value == true                                      "block or model"
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7554
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7555
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7556
    (numArgs := indication numArgs) == 2 ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7557
        recv := menuPanel receiver.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7558
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7559
        (recv isValueModel) ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7560
            (recv notNil or:[(recv := menuPanel application) notNil]) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7561
                sel := indication copyFrom:1 to:(indication indexOf:$:).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7562
                sel := sel asSymbol.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7563
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7564
                MessageNotUnderstood handle:[:ex| 
2737
b0daaddb418b Use MessageNotUnderstood>>#selector
Stefan Vogel <sv@exept.de>
parents: 2736
diff changeset
  7565
                    ex selector == sel ifFalse:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7566
                        ex reject
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7567
                    ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7568
                ] do:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7569
                    sel := recv perform:sel with:(menuItem argument)
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7570
                ]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7571
            ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7572
        ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7573
        ^ sel value == true
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7574
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7575
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7576
    numArgs ~~ 0 ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7577
        sel := (indication copyWithoutLast:1) asSymbol
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7578
    ] ifFalse:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7579
        sel := indication
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7580
    ].    
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7581
    sel := self aspectAt:sel.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7582
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7583
    sel isValueModel ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7584
        indication := sel.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7585
        indication addDependent:self.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7586
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7587
    ^ sel value == true
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7588
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7589
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7590
indicationValue:aValue
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7591
    "set the indication value"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7592
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7593
    |numArgs recv|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7594
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7595
    indication isNil ifTrue:[^ self].                                   "no indication specified"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7596
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7597
    indication isSymbol ifFalse:[                                       
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7598
        indication perform:#value: with:aValue ifNotUnderstood:nil.     "block or model"
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7599
        ^ self
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7600
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7601
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7602
    (numArgs := indication numArgs) == 0 ifTrue:[                       "no arguments to selector; cannot set"
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7603
        ^ self
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  7604
    ].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  7605
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7606
    recv := menuPanel receiver.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7607
    recv isValueModel ifTrue:[^ self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7608
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  7609
    recv isNil ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7610
        recv := menuPanel application.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7611
        recv isNil ifTrue:[^ self].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7612
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7613
2069
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  7614
    MessageNotUnderstood handle:[:ex| 
2737
b0daaddb418b Use MessageNotUnderstood>>#selector
Stefan Vogel <sv@exept.de>
parents: 2736
diff changeset
  7615
        (ex selector ~~ indication) ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7616
            ex reject
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7617
        ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7618
        self ifNotInUIBuilderInfoPrintCR:
2771
3328da9f3df8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2770
diff changeset
  7619
            ('MenuPanel::Item [info]: application (%1) does not respond to: %2' 
3328da9f3df8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2770
diff changeset
  7620
             bindWith:recv classNameWithArticle with:indication).
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7621
    ] do:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7622
        numArgs == 1 ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7623
            recv perform:indication with:aValue
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7624
        ] ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7625
            recv perform:indication with:(menuItem argument ? self) with:aValue
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7626
        ]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7627
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7628
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7629
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  7630
isEntered
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7631
    "returns true if the mouse pointer is over the item"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7632
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  7633
    ^ menuPanel enteredItem == self
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  7634
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  7635
    "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
  7636
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  7637
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  7638
separatorType
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7639
    "returns type of separator line or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7640
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7641
    |c lbl|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7642
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7643
    self isSeparator ifFalse:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7644
        ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7645
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7646
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7647
    (lbl := label value) isNil ifTrue:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7648
        ^ #singleLine
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7649
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7650
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7651
    lbl size == 1 ifTrue:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7652
        c := lbl first.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7653
        c == $- ifTrue:[^ #singleLine].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7654
        c == $= ifTrue:[^ #doubleLine].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7655
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7656
    ^ #blankLine
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  7657
!
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  7658
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  7659
setupSubmenu
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7660
    |appl master recv submenuHolder submenu submenuEncoding channel|
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7661
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7662
    channel := menuItem submenuChannel value.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7663
    channel isNil ifTrue:[ ^ subMenu ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7664
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7665
    subMenu notNil ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7666
        menuItem keepLinkedMenu ifTrue:[ ^ subMenu ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7667
    ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7668
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7669
    channel isSymbol ifFalse:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7670
        submenuHolder := channel
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7671
    ] ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7672
        appl := menuPanel application.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7673
        appl isNil ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7674
            appl := menuPanel receiver.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7675
            appl notNil ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7676
                (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7677
                    [submenuHolder isNil 
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7678
                     and:[(master := appl perform:#masterApplication ifNotUnderstood:nil) notNil
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7679
                          and:[master ~~ appl]]] whileTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7680
                        appl := master.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7681
                        submenuHolder := self findSubMenuIn:appl.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7682
                    ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7683
                ]
2232
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  7684
            ].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7685
        ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7686
        submenuHolder isNil ifTrue:[    
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7687
            (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7688
                (recv := menuPanel receiver) ~~ appl ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7689
                    appl := recv.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7690
                    submenuHolder := self findSubMenuIn:appl
2232
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  7691
                ]
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  7692
            ]
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7693
        ]
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7694
    ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7695
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7696
    (submenu := submenuHolder value) isArray ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7697
        submenuEncoding := submenu.    
3222
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  7698
        submenu := Menu decodeFromLiteralArray:submenuEncoding.
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7699
        "/ cg: linked menus also may contain translations ...
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7700
        submenu notNil ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7701
            appl notNil ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7702
                submenu findGuiResourcesIn:appl.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7703
            ]                
2232
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  7704
        ].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7705
    ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7706
    "/ appl notNil ifTrue:[submenu application:appl].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7707
    self submenu:submenu.
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  7708
    ^ subMenu
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  7709
3222
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  7710
    "Modified: / 27-03-2007 / 08:43:25 / cg"
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7711
!
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7712
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7713
spaceBetweenEmptyLines
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7714
        ^ 3
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7715
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7716
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7717
!MenuPanel::Item methodsFor:'queries'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7718
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  7719
canChangeVisibility
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7720
    "return true if I am not always visible; can only be changed by a selector
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7721
     otherwise there is a change notification raised if the model changed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7722
3122
81ab6b6b4ff2 *** empty log message ***
fm
parents: 3112
diff changeset
  7723
    ^ isVisible isSymbol or:[isVisible isValueModel]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7724
"/  ^ isVisible notNil and:[isVisible ~~ true]
3112
01341303806d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
  7725
01341303806d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
  7726
    "Modified: / 11-10-2006 / 21:43:31 / cg"
3122
81ab6b6b4ff2 *** empty log message ***
fm
parents: 3112
diff changeset
  7727
    "Modified: / 12-10-2006 / 09:30:48 / User"
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  7728
!
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  7729
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7730
canSelect
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7731
    "returns true if item is selectable; no separator, visible and enabled.
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7732
     in case of a choice (RadioButton) i have to check for the choiceValue"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7733
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7734
    self isSeparator ifTrue:[^ false].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7735
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7736
    (self isVisible and:[self enabled]) ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7737
        (choice isNil or:[choice value ~= menuItem choiceValue]) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7738
            ^ true
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7739
        ].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  7740
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  7741
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7742
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7743
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  7744
containsPoint:aPoint
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7745
    "returns true if aPoint is contained in my layout"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7746
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  7747
    (self isVisible and:[layout notNil]) ifTrue:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7748
        ^ layout containsPoint:aPoint
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  7749
    ].
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  7750
    ^ false
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  7751
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  7752
    "Created: / 13.11.2001 / 13:55:31 / cg"
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  7753
!
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  7754
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7755
containsPointX:x y:y
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7756
    "returns true if point is contained in my layout"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7757
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7758
    (self isVisible and:[layout notNil]) ifTrue:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7759
        ^ layout containsPointX:x y:y
505
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  7760
    ].
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  7761
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7762
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7763
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7764
hasDelayedMenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7765
    "returns true if a delayed menu exists"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7766
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  7767
    self hasSubmenu ifFalse:[
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  7768
        ^ false
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7769
    ].
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  7770
    menuItem itemValue notNil ifTrue:[ ^ true ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  7771
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  7772
    (indication isNil and:[choice isNil]) ifTrue:[
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  7773
        ^ false
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7774
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7775
    ^ true
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7776
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7777
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7778
hasDelayedMenuIndicator
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7779
    "returns true if the item has a delayed menu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7780
     and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7781
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7782
    menuPanel isPopUpView ifFalse:[
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7783
        ^ self hasDelayedMenu
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7784
    ].
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7785
    ^ false
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7786
!
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7787
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7788
hasIndication
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7789
    "returns true if on/off indication exists"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7790
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7791
    ^ indication notNil
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7792
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7793
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7794
hasMenuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7795
    "returns true if the item has a delayed menu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7796
     and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7797
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7798
    menuPanel isPopUpView ifFalse:[
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  7799
        ^ self hasSubmenu and:[menuItem isButton]
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7800
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7801
    ^ false
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7802
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7803
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7804
hasSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7805
    "returns true if the item is configured as an subMenu entry"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7806
    
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7807
    ^ subMenu notNil or:[ menuItem submenuChannel notNil ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7808
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7809
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7810
isEnabled
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7811
    "returns the enabled state"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7812
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7813
    ^ self enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7814
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7815
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7816
isSeparator
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7817
    "returns true if item is a separator"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7818
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7819
    ^ displayLabel isNil
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7820
!
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7821
2159
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  7822
isToggle
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7823
    "returns true if on/off indication exists"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7824
2159
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  7825
    ^ self hasIndication and:[ self isButton ]
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  7826
!
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  7827
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7828
isVisible
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7829
    "returns the visibility state"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7830
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7831
    |state|
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7832
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7833
    isVisible isSymbol ifTrue:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7834
        state := self aspectAt:isVisible.
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7835
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7836
        state isValueModel ifTrue:[
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7837
            isVisible := state.
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7838
            isVisible addDependent:self.
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7839
            state := isVisible.
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7840
        ]
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7841
    ] ifFalse:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7842
        state := isVisible
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  7843
    ].
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  7844
  ^ state value ~~ false
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  7845
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  7846
    "Modified: / 5.10.1998 / 12:08:28 / cg"
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7847
!
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7848
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7849
isVisible:something
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7850
    "change the visibility state; if the state changed, a redraw is performed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7851
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7852
    |oldState newState|
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7853
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7854
    isVisible isNil ifTrue:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7855
        oldState := true
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7856
    ] ifFalse:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7857
        oldState := isVisible value.
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7858
        isVisible isValueModel ifTrue:[
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7859
            isVisible removeDependent:self
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7860
        ]
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7861
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7862
    isVisible := something.
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7863
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7864
    isVisible isNil ifTrue:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7865
        newState := true
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7866
    ] ifFalse:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7867
        isVisible isValueModel ifTrue:[
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7868
            isVisible addDependent:self
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7869
        ] ifFalse:[
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7870
            isVisible isSymbol ifTrue:[^ self]
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7871
        ].
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7872
        menuPanel shown ifFalse:[^ self].
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7873
        newState := isVisible value.
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7874
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7875
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7876
    newState ~~ oldState ifTrue:[
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7877
        menuPanel mustRearrange
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7878
    ]
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  7879
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  7880
    "Modified: / 5.10.1998 / 12:12:04 / cg"
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7881
!
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7882
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7883
menuIndicatorContains:aPoint
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7884
    "returns true if the items delayed menu is hit by a button-press"
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7885
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7886
    |icon xSep|
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7887
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7888
    (self isVisible and:[layout notNil]) ifTrue:[
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7889
        (layout containsPoint:aPoint) ifTrue:[
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7890
            icon := self menuIndicatorIcon.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7891
            icon notNil ifTrue:[
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7892
                xSep := layout right - icon width.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7893
                ^ aPoint x >= xSep
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7894
            ]
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7895
        ]
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7896
    ].
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7897
    ^ false
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7898
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7899
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7900
needsItemSpaceWhenDrawing
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7901
    ^ self isSeparator not and:[menuItem isButton not]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7902
!
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7903
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7904
shortcutKeyAsString
3301
bb7fab3e1d7a *** empty log message ***
fm
parents: 3295
diff changeset
  7905
    "converts shortcutKey to a text object for the menu-label-hint"
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7906
2972
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  7907
    |shortcutKey|
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7908
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7909
    shortcutKey := menuItem shortcutKey.
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  7910
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  7911
    shortcutKey isNil ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7912
        ^ nil
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  7913
    ].
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  7914
    shortcutKey isCharacter ifTrue:[
3301
bb7fab3e1d7a *** empty log message ***
fm
parents: 3295
diff changeset
  7915
        shortcutKey == Character space ifFalse:[
bb7fab3e1d7a *** empty log message ***
fm
parents: 3295
diff changeset
  7916
            ^ 'Space'
bb7fab3e1d7a *** empty log message ***
fm
parents: 3295
diff changeset
  7917
        ].
2972
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  7918
        ^ shortcutKey asString
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  7919
    ].
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  7920
    ^ menuPanel device shortKeyStringFor:shortcutKey.
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  7921
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  7922
    "Modified: / 08-08-2006 / 15:46:24 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7923
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7924
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7925
!MenuPanel::Item methodsFor:'selection'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7926
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7927
isSelected
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7928
    "returns true if item is selected"
1998
5059b7c9cd2c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1997
diff changeset
  7929
5059b7c9cd2c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1997
diff changeset
  7930
    ^ menuPanel notNil and:[menuPanel selection == self]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7931
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7932
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7933
isSelected:isSelected
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  7934
    "change selection to a state. Dependant on the state open or hide an existing
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7935
     submenu and perform a redraw"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7936
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7937
    (isSelected and:[menuPanel notNil]) ifFalse:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7938
        self invalidate.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7939
        self hideSubmenu.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7940
        ^ self
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7941
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7942
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7943
    menuPanel realized ifFalse:[ ^ self ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7944
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7945
    (indication isNil or:[menuItem isButton not]) ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7946
        self invalidate
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7947
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7948
    self hasSubmenu ifFalse:[ ^ self].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7949
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7950
    self hasDelayedMenu ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7951
        menuPanel openDelayed:self
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7952
    ] ifFalse:[
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7953
        self setupSubmenu.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  7954
        subMenu notNil ifTrue:[ self openSubmenu ].
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7955
    ].
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7956
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7957
    "Modified: / 07-11-2006 / 11:08:03 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7958
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7959
2692
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  7960
!MenuPanel::Item::Adornment methodsFor:'accessing'!
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  7961
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  7962
argument2
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  7963
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  7964
  ^ argument2
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  7965
!
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  7966
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  7967
argument2:anArgumentOrNil
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  7968
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  7969
    argument2 := anArgumentOrNil
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  7970
! !
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  7971
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7972
!MenuPanel::ScrollActivity class methodsFor:'default icons'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7973
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7974
icon
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7975
    "This resource specification was automatically generated
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7976
     by the ImageEditor of ST/X."
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7977
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7978
    "Do not manually edit this!! If it is corrupted,
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7979
     the ImageEditor may not be able to read the specification."
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7980
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7981
    "
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7982
     self icon inspect
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7983
     ImageEditor openOnClass:self andSelector:#icon
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7984
    "
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7985
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7986
    <resource: #image>
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7987
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7988
    ^Icon
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  7989
	constantNamed:#'MenuPanel::Scrolling class icon'
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  7990
	ifAbsentPut:[(Depth1Image new) width: 11; height: 11; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?>@@@@@@ @C@@N@@<@C8@O<@@@@@@@@a') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 11; height: 11; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@_<@? A<@C @D@@@@@@@@@@@a') ; yourself); yourself]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7991
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7992
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7993
!MenuPanel::ScrollActivity class methodsFor:'instance creation'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7994
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7995
new
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7996
    ^ self basicNew initialize
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7997
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7998
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7999
!MenuPanel::ScrollActivity methodsFor:'accessing'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8000
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8001
activeMenu
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8002
    "returns the active menu the scrolling is activated on; nil
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8003
     is returned if scrolling is deactivated"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8004
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8005
    ^ activeMenu
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8006
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8007
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8008
direction
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8009
    "returns the scroll-direction"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8010
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8011
    ^ direction
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8012
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8013
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8014
iconAt:aDirection on:aMenu
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8015
    |icon device index|
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8017
    device := aMenu device.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8018
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8019
    aDirection == #PREV ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  8020
	aMenu verticalLayout ifTrue:[index := 3]    "/ 3 - 1 * 90  180
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  8021
			    ifFalse:[index := 2]    "/ 2 - 1 * 90  90   
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8022
    ] ifFalse:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  8023
	aMenu verticalLayout ifTrue:[index := 1]    "/ 1 - 1 * 90  0
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  8024
			    ifFalse:[index := 4]    "/ 4 - 1 * 90  270
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8025
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8026
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8027
    icon := icons at:index.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8028
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8029
    (icon isNil or:[icon device ~~ device]) ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  8030
	icon := self class icon.
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  8031
	index > 1 ifTrue:[ icon := icon rotated:(index - 1 * 90) ]
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  8032
		 ifFalse:[ icon := icon copy ].
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  8033
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  8034
	icon := icon onDevice:device.
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  8035
	icon clearMaskedPixels.
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  8036
	icons at:index put:icon
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8037
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8038
    ^ icon
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8039
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8040
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  8041
!MenuPanel::ScrollActivity methodsFor:'initialization'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8042
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8043
initialize
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8044
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8045
    semaLock := RecursionLock new.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8046
    icons    := Array new:4.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8047
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8048
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  8049
!MenuPanel::ScrollActivity methodsFor:'queries'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8050
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8051
isActive
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8052
    "returns true if scrolling is activated"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8053
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8054
    ^ activeMenu notNil
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8055
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8056
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  8057
!MenuPanel::ScrollActivity methodsFor:'user operations'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8058
3295
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8059
startIfRequiredAt:aDirection on:aMenu comesViaButtonPress:comesViaButtonPress
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8060
    "start scrolling; returns true if scrolling is activated"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8061
3295
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8062
    |bounds index isScrolledMenu boundsOnRoot|
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8063
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8064
    isScrolledMenu := (aDirection notNil and:[aMenu notNil and:[aMenu hasScrollers]]).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8065
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8066
    semaLock critical:[
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8067
        self stop.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8068
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8069
        isScrolledMenu ifTrue:[
3295
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8070
            bounds := aMenu scrollerBoundsAt:aDirection.
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8071
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8072
            comesViaButtonPress ifFalse:[
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8073
                boundsOnRoot := Rectangle origin:(aMenu device translatePointToRoot:(bounds origin) fromView:aMenu)
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8074
                                          extent:(bounds extent).
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8075
            ].
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8076
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8077
            activeMenu := aMenu.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8078
            direction  := aDirection.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8079
            index      := aMenu indexOfItemAtScroller:aDirection.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8080
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8081
            index ~~ 0 ifTrue:[
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8082
                scrollTask := 
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8083
                    [ 
3295
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8084
                        |item step continue|
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8085
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8086
                        [
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8087
                            step := (aDirection == #PREV) ifTrue:[-1] ifFalse:[1].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8088
                            ( aMenu shown and:[(item := aMenu itemAt:index) notNil] ) ifTrue:[
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8089
                                aMenu makeItemVisible:item.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8090
                                index := index + step.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8091
                            ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8092
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8093
                            Delay waitForSeconds:(ButtonController defaultInitialDelay).
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8094
3295
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8095
                            [
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8096
                                continue := (aMenu shown and:[(item := aMenu itemAt:index) notNil]).
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8097
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8098
                                boundsOnRoot notNil ifTrue:[
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8099
                                    continue ifTrue:[
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8100
                                        continue := boundsOnRoot containsPoint:aMenu sensor mousePoint.
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8101
                                    ] ifFalse:[
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8102
                                        boundsOnRoot := nil.
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8103
                                    ]
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8104
                                ].
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8105
                                continue
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8106
                            ]  whileTrue:[
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8107
                                aMenu makeItemVisible:item.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8108
                                Delay waitForSeconds:(ButtonController defaultRepeatDelay).
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8109
                                index := index + step.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8110
                            ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8111
                            item := nil.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8112
                        ] ensure:[
3295
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8113
                            activeMenu := direction := scrollTask := nil.
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8114
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8115
                            item notNil ifTrue:[
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8116
                                "/ process was killed
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8117
                                aMenu invalidate:bounds
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8118
                            ]
3295
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8119
                        ].
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8120
                        boundsOnRoot notNil ifTrue:[ aMenu invalidate:bounds ].
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8121
                    ] forkAt:8.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8122
            ]
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8123
        ]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8124
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8125
    ^ bounds notNil
2047
62de65e3a61b initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents: 2046
diff changeset
  8126
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  8127
    "Created: ca"
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  8128
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  8129
    "Modified: / 13.11.2001 / 20:15:52 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8130
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8131
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8132
stop
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8133
    "stop scrolling; returns true if the scrolling was activated otherwise false"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8134
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8135
    |task resp|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8136
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8137
    activeMenu isNil ifTrue:[
2231
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  8138
        ^ false
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8139
    ].
3295
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8140
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8141
    semaLock critical:[
2231
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  8142
        resp := activeMenu notNil.
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  8143
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  8144
        (task := scrollTask) notNil ifTrue:[
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  8145
            scrollTask := nil.
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  8146
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  8147
            Error handle:[:ex|
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  8148
            ] do:[
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  8149
                task terminateWithAllSubprocessesInGroup.
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  8150
                task waitUntilTerminated.
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  8151
            ].
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  8152
        ].
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  8153
        activeMenu := direction := nil.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8154
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8155
    ^ resp
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8156
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8157
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8158
!MenuPanel class methodsFor:'documentation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8159
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8160
version
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  8161
    ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.479 2008-10-24 14:14:42 cg Exp $'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8162
! !
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8163
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8164
MenuPanel initialize!