MenuPanel.st
author Claus Gittinger <cg@exept.de>
Thu, 17 Jan 2013 11:45:14 +0100
changeset 4167 9b0b4f8a3b90
parent 4153 2de187bba3f8
child 4172 3a90b8082486
permissions -rw-r--r--
changed: #keyPress:x:y:
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
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
    15
	instanceVariableNames:'shadowView mapTime mustRearrange superMenu shortKeyInset
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
    16
		selection items groupSizes receiver enabled lastActiveMenu
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
    17
		enteredItem prevFocusView previousPointerGrab
3147
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
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
    24
		stringOffsetX doAccessCharacterTranslation lastItem hasPerformed
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
    25
		focusComesByTab lastDrawnScrollerNextBounds
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
    26
		buttonActiveBackgroundColor buttonEnteredBackgroundColor
4110
e5d8fe91874e class definition
Claus Gittinger <cg@exept.de>
parents: 4109
diff changeset
    27
		buttonPassiveBackgroundColor maxExtent'
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    28
	classVariableNames:'InitialSelectionQuerySignal Images LigthenedImages
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    29
		DefaultForegroundColor DefaultBackgroundColor IconIndicationOn
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    30
		IconIndicationOff IconRadioOn IconRadioOff
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    31
		IconDisabledIndicationOn IconDisabledIndicationOff
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    32
		IconDisabledRadioOn IconDisabledRadioOff'
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    33
	poolDictionaries:''
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    34
	category:'Views-Menus'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    35
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    36
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    37
Object subclass:#Item
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    38
	instanceVariableNames:'menuItem layout menuPanel subMenu displayLabel displayLabelExtent
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    39
		disabledDisplayLabel enableChannel label activeHelpText
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    40
		flyByHelpText isVisible indication choice accessCharacter'
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    41
	classVariableNames:'HorizontalInset VerticalInset HorizontalButtonInset
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    42
		VerticalButtonInset LabelRightOffset VerticalPopUpInset'
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    43
	poolDictionaries:''
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    44
	privateIn:MenuPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    45
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    46
2692
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
    47
Object subclass:#Adornment
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    48
	instanceVariableNames:'indication accessCharacterPosition shortcutKey argument argument2
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    49
		choice choiceValue'
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    50
	classVariableNames:''
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    51
	poolDictionaries:''
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    52
	privateIn:MenuPanel::Item
2692
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
    53
!
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
    54
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
    55
Object subclass:#ScrollActivity
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    56
	instanceVariableNames:'semaLock activeMenu scrollTask direction icons'
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    57
	classVariableNames:''
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    58
	poolDictionaries:''
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    59
	privateIn:MenuPanel
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
    60
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
    61
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    62
!MenuPanel class methodsFor:'documentation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    63
2005
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    64
copyright
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
 COPYRIGHT (c) 1997 by eXept Software AG
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    67
	      All Rights Reserved
2005
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    68
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    69
 This software is furnished under a license and may be used
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    70
 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
    71
 inclusion of the above copyright notice.   This software may not
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    72
 be provided or otherwise made available to, or used by, any
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    73
 other person.  No title to or ownership of the software is
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    74
 hereby transferred.
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    75
"
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    76
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    77
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    78
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    79
documentation
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    80
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    81
    a menu panel used for both pull-down-menus and pop-up-menus.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    82
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
    83
    this will eventually replace most of the MenuView and PopUpMenu stuff.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    84
    (and hopefully be ST-80 compatible ...)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    85
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    86
    To create a menu, there exists a MenuEditor which will generate
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    87
    a menu specification.
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    88
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    89
2061
faf64f2cd28e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2059
diff changeset
    90
    Notice:
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
    91
	This is going to replace the obsolete MenuView.
2061
faf64f2cd28e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2059
diff changeset
    92
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    93
    [author:]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
    94
	Claus Atzkern
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    95
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    96
    [see also:]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
    97
	Menu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
    98
	MenuItem
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
    99
	MenuEditor
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
   100
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
   101
    cg: this code is so ugly - needs a complete rewrite...
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
   102
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   103
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   104
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   105
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   106
examples
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   107
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   108
"
4081
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   109
  a PullDownMenu
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   110
                                                                                [exBegin]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   111
    |top subView mview desc s1 s2 s3 img lbs labels|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   112
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   113
    top := StandardSystemView new.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   114
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   115
    mview := MenuPanel in:top.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   116
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   117
    labels := #( 'foo' 'bar' 'baz' 'test' 'claus' ).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   118
    mview level:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   119
    mview verticalLayout:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   120
    img := Image fromFile:'bitmaps/SBrowser.xbm'.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   121
    lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test' with:'ludwig'.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   122
    mview labels:lbs.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   123
    mview shortcutKeyAt:2 put:#Cut.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   124
    mview accessCharacterPositionAt:1 put:1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   125
    mview accessCharacterPositionAt:2 put:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   126
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   127
    mview enabledAt:5 put:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   128
    mview groupSizes:#( 2 2 ).
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   129
    s1 := MenuPanel labels:labels.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   130
    s1 accessCharacterPositionAt:1 put:1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   131
    s1 accessCharacterPositionAt:2 put:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   132
    s1 groupSizes:#( 2 2 ).
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   133
    s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ).
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   134
    s3 := MenuPanel labels:lbs.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   135
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   136
    s1 subMenuAt:2 put:s2.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   137
    s1 subMenuAt:3 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   138
    s2 subMenuAt:3 put:s3.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   139
    s3 subMenuAt:3 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   140
    s3 shortcutKeyAt:3 put:$q.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   141
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   142
    mview subMenuAt:1 put:s1.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   143
    mview subMenuAt:4 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   144
    (mview subMenuAt:4) shortcutKeyAt:3 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   145
    s1 shortcutKeyAt:1 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   146
    s1 shortcutKeyAt:3 put:#Paste.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   147
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   148
    mview subMenuAt:2 put:(MenuPanel labels:labels).
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   149
    top extent:(mview preferredExtent).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   150
    top open.
4081
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   151
                                                                                [exEnd]
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   152
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   153
  a PullDownMenu with applications
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   154
                                                                                [exBegin]
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   155
    |top menu view item|
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   156
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   157
    top  := StandardSystemView extent:240@100.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   158
    menu := MenuPanel in:top.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   159
    menu labels:#( 'foo' 'Application' 'Clock' ).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   160
    menu verticalLayout:false.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   161
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   162
    menu subMenuAt:1 put:(MenuPanel labels:#( 'bar' 'baz' )).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   163
    menu subMenuAt:2 put:(MenuPanel labels:#( 'foo' 'bar' 'baz' )).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   164
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   165
    view := ClockView new.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   166
    view preferredExtent:100@100.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   167
    item := menu itemAt:3.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   168
    item submenu:view.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   169
4081
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   170
    view := ImageView new.
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   171
    view image:(Image fromScreen:(0@0 corner:200@200)).
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   172
    view preferredExtent:(200@200).
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   173
    item := menu itemAt:2.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   174
    item submenu:view.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   175
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   176
    menu origin:0@0 corner:1.0@30.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   177
    top open.
4081
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   178
                                                                                [exEnd]
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   179
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   180
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   181
  a PopUpMenu
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   182
                                                                                [exBegin]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   183
    |subView mview desc s1 s2 s3 img lbs labels|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   184
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   185
    mview := MenuPanel new.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   186
    labels := #( 'foo' 'bar' 'baz' ).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   187
    mview level:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   188
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   189
    img := Image fromFile:'bitmaps/SBrowser.xbm'.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   190
    lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test'.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   191
    mview labels:lbs.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   192
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   193
    s1 := MenuPanel labels:labels.
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   194
    s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ).
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   195
    s3 := MenuPanel labels:lbs.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   196
    s1 subMenuAt:2 put:s2.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   197
    s1 subMenuAt:3 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   198
    s2 subMenuAt:3 put:s3.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   199
    s3 subMenuAt:3 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   200
    s3 shortcutKeyAt:3 put:$q.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   201
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   202
    mview subMenuAt:1 put:s1.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   203
    mview subMenuAt:4 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   204
    (mview subMenuAt:4) shortcutKeyAt:3 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   205
    s1 shortcutKeyAt:1 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   206
    s1 shortcutKeyAt:3 put:#Paste.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   207
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   208
    mview subMenuAt:2 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   209
    mview startUp
4081
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   210
                                                                                [exEnd]
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   211
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   212
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   213
  a menu spec
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   214
                                                                                [exBegin]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   215
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   216
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   217
    menu := MenuPanel menu:
4081
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   218
        #(#Menu #( #(#MenuItem
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   219
                    #label: 'File'
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   220
                    #submenu:
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   221
                      #(#Menu #(#(#MenuItem #label: 'quit' #value:#quit )
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   222
                                 (#MenuItem
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   223
                                    #label: 'edit'
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   224
                                    #submenu:
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   225
                                      #(#Menu #( #(#MenuItem #label: 'edit'  #value:#edit )
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   226
                                                 #(#MenuItem #label: 'close' #value:#close)
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   227
                                               )
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   228
                                               nil
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   229
                                               nil
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   230
                                       )
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   231
                                  )
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   232
                                 #(#MenuItem #label: 'help' #value:#help )
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   233
                               )
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   234
                               nil
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   235
                               nil
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   236
                       )
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   237
                 )
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   238
                #(#MenuItem #label: 'Inspect' #value:#inspectMenu )
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   239
                #(#MenuItem #label: 'Bar'
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   240
                            #submenu:
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   241
                               #(#Menu #( #(#MenuItem #label: 'bar 1' #value:#bar1 )
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   242
                                          #(#MenuItem #label: 'bar 2' #value:#bar2 )
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   243
                                        )
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   244
                                        nil
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   245
                                        nil
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   246
                                )
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   247
                 )
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   248
              )
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   249
              #( 2 )
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   250
              nil
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   251
         ) decodeAsLiteralArray.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   252
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   253
    menu verticalLayout:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   254
    Transcript showCR:(menu startUp).
4081
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   255
                                                                                [exEnd]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   256
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   257
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   258
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   259
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   260
!MenuPanel class methodsFor:'instance creation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   261
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   262
fromSpec:aSpec
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   263
    ^ self fromSpec:aSpec receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   264
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   265
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   266
fromSpec:aSpec receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   267
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   268
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   269
    aSpec notNil ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   270
	menu := Menu new.
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   271
	menu receiver:aReceiver.
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   272
	menu fromLiteralArrayEncoding:aSpec.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   273
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   274
  ^ self menu:menu receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   275
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   276
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   277
labels:labels
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   278
    ^ self labels:labels nameKeys:nil receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   279
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   280
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   281
labels:labels nameKeys:nameKeys
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   282
    ^ self labels:labels nameKeys:nameKeys receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   283
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   284
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   285
labels:labels nameKeys:nameKeys receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   286
    |mview|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   287
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   288
    mview := self menu:nil receiver:aReceiver.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   289
    mview labels:labels.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   290
    mview nameKeys:nameKeys.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   291
  ^ mview
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   292
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   293
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   294
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   295
labels:labels receiver:aReceiver
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   296
    ^ self labels:labels nameKeys:nil receiver:aReceiver
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   297
!
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   298
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   299
menu:aMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   300
    ^ self menu:aMenu receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   301
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   302
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   303
menu:aMenu receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   304
    |mview|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   305
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   306
    mview := self new.
1955
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   307
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   308
    (aMenu notNil and:[aMenu receiver isNil]) ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   309
	"/ no receiver specified in the menu; thus set the receiver immediately
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   310
	mview receiver:aReceiver
1955
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   311
    ].
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   312
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   313
    mview menu:aMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   314
1955
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   315
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   316
"/ a menu itself may contain a receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   317
"/ thus we do not overwrite the receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   318
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   319
    aReceiver notNil ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   320
	mview receiver:aReceiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   321
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   322
  ^ mview
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   323
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   324
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   325
!MenuPanel class methodsFor:'class initialization'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   326
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   327
initialize
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   328
    InitialSelectionQuerySignal isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   329
	InitialSelectionQuerySignal := QuerySignal new.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   330
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   331
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   332
    "
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   333
     self initialize
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   334
    "
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   335
660
d1670dfe5445 Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents: 658
diff changeset
   336
    "Modified: / 15.1.1998 / 23:08:31 / stefan"
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   337
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   338
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   339
preSnapshot
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   340
    "remove all resources"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   341
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   342
    Images := nil.
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   343
    LigthenedImages := nil.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   344
! !
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   345
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   346
!MenuPanel class methodsFor:'default icons'!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   347
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   348
delayedMenuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   349
    "This resource specification was automatically generated
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   350
     by the ImageEditor of ST/X."
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
    "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
   353
     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
   354
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   355
    "
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   356
     self delayedMenuIndicator inspect
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   357
     ImageEditor openOnClass:self andSelector:#delayedMenuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   358
     Icon flushCachedIcons
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
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   361
    <resource: #image>
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   362
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   363
    ^Icon
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   364
	constantNamed:#'MenuPanel class delayedMenuIndicator'
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   365
	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]
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   366
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   367
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   368
iconIndicationDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   369
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   370
     by the ImageEditor of ST/X."
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
    "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
   373
     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
   374
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
     self iconIndicationDisabledOff inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   377
     ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   378
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   379
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   380
    <resource: #image>
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   381
2755
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   382
    IconDisabledIndicationOff isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   383
	IconDisabledIndicationOff := Icon
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   384
	    constantNamed:#'MenuPanel iconIndicationDisabledOff'
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   385
	    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]
2755
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   386
    ].
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   387
    ^ IconDisabledIndicationOff
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   388
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   389
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   390
iconIndicationDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   391
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   392
     by the ImageEditor of ST/X."
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
    "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
   395
     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
   396
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
     self iconIndicationDisabledOn inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   399
     ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   400
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   401
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   402
    <resource: #image>
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   403
2755
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   404
    IconDisabledIndicationOn isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   405
	IconDisabledIndicationOn := Icon
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   406
	    constantNamed:#'MenuPanel iconIndicationDisabledOn'
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   407
	    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]
2755
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   408
    ].
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   409
    ^ IconDisabledIndicationOn
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   410
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   411
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   412
iconIndicationOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   413
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   414
     by the ImageEditor of ST/X."
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
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   417
     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
   418
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
     self iconIndicationOff inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   421
     ImageEditor openOnClass:self andSelector:#iconIndicationOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   422
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   423
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   424
    <resource: #image>
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   425
2752
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   426
    IconIndicationOff isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   427
	IconIndicationOff := Icon
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   428
	    constantNamed:#'MenuPanel iconIndicationOff'
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   429
	    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]
2752
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   430
    ].
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   431
    ^ IconIndicationOff
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   432
!
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   433
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   434
iconIndicationOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   435
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   436
     by the ImageEditor of ST/X."
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
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   439
     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
   440
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
     self iconIndicationOn inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   443
     ImageEditor openOnClass:self andSelector:#iconIndicationOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   444
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   445
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   446
    <resource: #image>
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   447
2752
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   448
    IconIndicationOn isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   449
	IconIndicationOn := Icon
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   450
		constantNamed:#'MenuPanel iconIndicationOn'
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   451
		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]
2752
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   452
    ].
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   453
    ^ IconIndicationOn
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   454
!
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   455
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   456
iconRadioGroupDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   457
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   458
     by the ImageEditor of ST/X."
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
    "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
   461
     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
   462
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
     self iconRadioGroupDisabledOff inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   465
     ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   466
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   467
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   468
"/    <resource: #image>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   469
"/
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   470
"/    IconDisabledRadioOff isNil ifTrue:[
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   471
"/        IconDisabledRadioOff := Icon
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   472
"/            constantNamed:#'MenuPanel iconRadioGroupDisabledOff'
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   473
"/            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
   474
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   475
"/    ^ IconDisabledRadioOff
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   476
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   477
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   478
    ^ RadioButton disabledPassiveForm
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   479
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   480
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   481
iconRadioGroupDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   482
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   483
     by the ImageEditor of ST/X."
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
    "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
   486
     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
   487
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   488
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   489
     self iconRadioGroupDisabledOn inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   490
     ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOn
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
   491
     Icon flushCachedIcons
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   492
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   493
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   494
"/    <resource: #image>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   495
"/
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   496
"/    IconDisabledRadioOn isNil ifTrue:[
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   497
"/        IconDisabledRadioOn := Icon
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   498
"/            constantNamed:#'MenuPanel class iconRadioGroupDisabledOn'
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   499
"/            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
   500
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   501
"/    ^ IconDisabledRadioOn
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
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   504
    ^ RadioButton disabledActiveForm
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   505
!
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   506
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   507
iconRadioGroupEnteredOff
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   508
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   509
    ^ RadioButton enteredPassiveForm
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   510
!
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   511
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   512
iconRadioGroupEnteredOn
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   513
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   514
    ^ RadioButton enteredActiveForm
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   515
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   516
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   517
iconRadioGroupOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   518
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   519
     by the ImageEditor of ST/X."
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
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   522
     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
   523
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
     self iconRadioGroupOff inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   526
     ImageEditor openOnClass:self andSelector:#iconRadioGroupOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   527
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   528
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   529
"/    <resource: #image>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   530
"/
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   531
"/    IconRadioOff isNil ifTrue:[
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   532
"/        IconRadioOff := Icon
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   533
"/            constantNamed:#'MenuPanel iconRadioGroupOff'
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   534
"/            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
   535
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   536
"/    ^ IconRadioOff
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   537
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   538
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   539
    ^ RadioButton passiveForm
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   540
!
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   541
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   542
iconRadioGroupOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   543
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   544
     by the ImageEditor of ST/X."
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
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   547
     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
   548
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
     self iconRadioGroupOn inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   551
     ImageEditor openOnClass:self andSelector:#iconRadioGroupOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   552
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   553
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   554
"/    <resource: #image>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   555
"/
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   556
"/    IconRadioOn isNil ifTrue:[
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   557
"/        IconRadioOn := Icon
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   558
"/            constantNamed:#'MenuPanel iconRadioGroupOn'
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   559
"/            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
   560
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   561
"/    ^ IconRadioOn
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   562
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   563
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   564
    ^ RadioButton activeForm
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   565
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   566
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   567
menuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   568
    "This resource specification was automatically generated
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   569
     by the ImageEditor of ST/X."
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
    "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
   572
     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
   573
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   574
    "
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   575
     self menuIndicator inspect
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   576
     ImageEditor openOnClass:self andSelector:#menuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   577
     Icon flushCachedIcons
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
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   580
    <resource: #image>
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   581
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   582
    ^Icon
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   583
	constantNamed:#'MenuPanel class menuIndicator'
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   584
	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
   585
! !
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   586
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   587
!MenuPanel class methodsFor:'defaults'!
450
ac72eb2ed895 initialize fix
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   588
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   589
defaultBackgroundColor
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
   590
    DefaultBackgroundColor notNil ifTrue:[^ DefaultBackgroundColor].
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   591
    ^ StyleSheet at:#'pullDownMenu.backgroundColor' default:DefaultViewBackgroundColor.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   592
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   593
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   594
defaultLevel
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   595
    ^ StyleSheet at:#'pullDownMenu.level' default:1
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   596
"
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   597
self defaultLevel
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   598
"
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   599
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   600
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   601
delayedMenuIndicatorOffset
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   602
    "returns an additional offset between the label and the
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   603
     delayedMenu indication (i.e. the down-arrow icon)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   604
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   605
    ^ 1 "2"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   606
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   607
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   608
maxShortCutSearchLevel
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   609
    "1 means: only search in top items.
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   610
     2 means: search one level of menus.
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   611
     used to be 10"
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   612
3384
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   613
    MaxShortCutSearchLevel isNil ifTrue:[MaxShortCutSearchLevel := 2.].
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   614
    ^ MaxShortCutSearchLevel
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   615
!
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   616
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   617
maxShortCutSearchLevel: anInteger
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   618
    "1 means: only search in top items.
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   619
     2 means: search one level of menus."
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   620
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   621
    MaxShortCutSearchLevel := anInteger
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   622
!
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   623
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   624
menuIndicatorOffset
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   625
    "returns an additional offset between the label and the
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   626
     delayedMenu indication (i.e. the down-arrow icon)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   627
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   628
    ^ 1 "2"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   629
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   630
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   631
mnemonicIdentifier
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   632
    "returns the identifier each mnemonic starts with;
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   633
     ex:
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   634
	&File   mnemonic := Cmdf
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   635
	F&ile   mnemonic := Cmdi
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   636
	....."
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   637
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   638
    ^ 'Cmd'
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   639
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   640
450
ac72eb2ed895 initialize fix
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   641
updateStyleCache
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
   642
    "extract values from the styleSheet and cache them in class variables"
657
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   643
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   644
    <resource: #style (
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   645
        #'selection.disabledForegroundColor'
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   646
        #'pullDownMenu.foregroundColor' #'pullDownMenu.backgroundColor' #'pullDownMenu.level'
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   647
        #'menu.itemHorizontalSpace' #'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace'
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   648
        #'menu.itemSpace' #'menu.buttonItemVerticalSpace'
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   649
        #'menu.buttonActiveLevel' #'menu.buttonPassiveLevel' #'menu.buttonEnteredLevel'
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   650
        #'menu.hilightLevel' #'menu.enteredLevel'
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   651
        #'menu.groupDividerSize' #'menu.itemMargin'
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   652
        #'menu.disabledEtchedForegroundColor' #'menu.hilightForegroundColor'
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   653
        #'menu.enteredBackgroundColor' #'menu.enteredForegroundColor'
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   654
        #'menu.disabledForegroundColor' #'menu.buttonEnteredBackgroundColor'
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   655
        #'menu.selectionFollowsMouse'
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   656
        #'button.disabledEtchedForegroundColor' #'button.disabledForegroundColor'
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   657
        #'button.activeBackgroundColor' #'button.backgroundColor' #'button.lightColor'
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   658
        #'button.enteredBackgroundColor' #'button.halfLightColor' #'button.halfShadowColor'
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   659
        #'button.activeLevel' #'button.passiveLevel' #'button.edgeStyle'
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   660
        #'menu.iconIndicationOn' #'menu.iconIndicationOff'
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   661
        #'menu.iconIndicationOn.bitmapFile' #'menu.iconIndication.bitmapOffFile'
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   662
        #'menu.iconDisabledIndicationOn' #'menu.iconDisabledIndicationOff'
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   663
        #'menu.iconDisabledIndicationOn.bitmapFile' #'menu.iconDisabledIndication.bitmapOffFile'
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   664
        #'menu.iconRadioOn' #'menu.iconRadioOff'
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   665
        #'menu.iconRadioOn.bitmapFile' #'menu.iconRadioOff.bitmapFile'
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   666
        #'menu.iconDisabledRadioOn' #'menu.iconDisabledRadioOff'
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   667
        #'menu.iconDisabledRadioOn.bitmapFile' #'menu.iconDisabledRadioOff.bitmapFile'
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   668
    )>
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   669
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   670
    |styleSheet style var foregroundColor backgroundColor buttonPassiveBackgroundColor
2754
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   671
    buttonActiveLevel buttonPassiveLevel buttonEnteredLevel getBitmapOrFile|
2607
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   672
2611
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   673
    "clear DefaultBackgroundColor caused by accessing the #defaultBackgroundColor
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   674
     which returns the default cashed DefaultBackgroundColor
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   675
    "
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   676
    DefaultBackgroundColor := nil.
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   677
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   678
    MenuView            updateStyleCache.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   679
    SelectionInListView updateStyleCache.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   680
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   681
    styleSheet  := StyleSheet.
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   682
    style       := styleSheet name.
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   683
2607
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   684
    DefaultFont     := MenuView defaultFont.
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   685
    foregroundColor := DefaultForegroundColor := styleSheet colorAt:#'pullDownMenu.foregroundColor'
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   686
                                                            default:[styleSheet
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   687
                                                                        colorAt:#'menu.foregroundColor'
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   688
                                                                        default:Color black].
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
   689
    backgroundColor := DefaultBackgroundColor := self defaultBackgroundColor.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   690
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   691
    var := styleSheet colorAt:#'menu.hilightBackgroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   692
    var isNil ifTrue:[
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   693
        style == #motif ifTrue:[ var := backgroundColor ]
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   694
                       ifFalse:[ var := styleSheet is3D ifFalse:[foregroundColor] ifTrue:[backgroundColor] ]
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   695
    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   696
    styleSheet at:#'menuPanel.activeBackgroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   697
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   698
    var := styleSheet colorAt:#'menu.disabledEtchedForegroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   699
    var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledEtchedForegroundColor' ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   700
    styleSheet at:#'menuPanel.disabledEtchedFgColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   701
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   702
    var := styleSheet colorAt:#'menu.disabledForegroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   703
    var isNil ifTrue:[
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   704
        var := styleSheet colorAt:#'selection.disabledForegroundColor'.
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   705
        var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledForegroundColor' default:Color darkGray ]
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   706
    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   707
    styleSheet at:#'menuPanel.disabledForegroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   708
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   709
    var := styleSheet colorAt:#'menu.hilightForegroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   710
    var isNil ifTrue:[ var := styleSheet is3D ifTrue:[foregroundColor] ifFalse:[backgroundColor] ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   711
    styleSheet at:#'menuPanel.activeForegroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   712
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   713
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   714
    buttonActiveLevel := styleSheet at:#'menu.buttonActiveLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]).
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   715
    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
   716
    styleSheet at:#'menuPanel.buttonActiveLevel' put:buttonActiveLevel.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   717
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   718
    buttonPassiveLevel := styleSheet at:#'menu.buttonPassiveLevel'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   719
    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
   720
    styleSheet at:#'menuPanel.buttonPassiveLevel' put:buttonPassiveLevel.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   721
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   722
    buttonEnteredLevel := styleSheet at:#'menu.buttonEnteredLevel' default:buttonPassiveLevel.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   723
    styleSheet at:#'menuPanel.buttonEnteredLevel' put:buttonEnteredLevel.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   724
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   725
    var := (buttonActiveLevel abs max:(buttonPassiveLevel abs)) max:(buttonEnteredLevel abs).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   726
    styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   727
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   728
    buttonPassiveBackgroundColor := styleSheet at:#'button.backgroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   729
    buttonPassiveBackgroundColor isNil ifTrue:[
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   730
        buttonPassiveBackgroundColor := (styleSheet at:'viewBackground') ? backgroundColor
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   731
    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   732
    styleSheet at:#'menuPanel.buttonPassiveBackgroundColor' put:buttonPassiveBackgroundColor.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   733
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   734
    var := styleSheet at:#'button.lightColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   735
    var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) lightened ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   736
    styleSheet at:#'menuPanel.buttonLightColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   737
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   738
    var :=  styleSheet at:#'button.shadowColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   739
    var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) darkened ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   740
    styleSheet at:#'menuPanel.buttonShadowColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   741
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   742
    var := styleSheet colorAt:#'menu.buttonEnteredBackgroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   743
    var isNil ifTrue:[ var := styleSheet colorAt:#'button.enteredBackgroundColor' default:buttonPassiveBackgroundColor ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   744
    styleSheet at:#'menuPanel.buttonEnteredBackgroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   745
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   746
    Item updateStyleCache.
2607
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   747
2754
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   748
    getBitmapOrFile := [:key :fileKey |
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   749
        |var|
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   750
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   751
        var := styleSheet at:key ifAbsent:nil.
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   752
        var isNil ifTrue:[
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   753
            var := styleSheet at:fileKey ifAbsent:nil.
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   754
            var notNil ifTrue:[
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   755
                var := Smalltalk imageFromFileNamed:var forClass:self.
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   756
            ].
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   757
        ].
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   758
        var
2754
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   759
    ].
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   760
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   761
    IconIndicationOn := getBitmapOrFile value:#'menu.iconIndicationOn' value:#'menu.iconIndicationOn.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   762
    IconIndicationOff := getBitmapOrFile value:#'menu.iconIndicationOff' value:#'menu.iconIndicationOff.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   763
    IconDisabledIndicationOn := getBitmapOrFile value:#'menu.iconDisabledIndicationOn' value:#'menu.iconDisabledIndicationOn.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   764
    IconDisabledIndicationOff := getBitmapOrFile value:#'menu.iconDisabledIndicationOff' value:#'menu.iconDisabledIndicationOff.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   765
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   766
    IconRadioOn := getBitmapOrFile value:#'menu.iconRadioOn' value:#'menu.iconRadioOn.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   767
    IconRadioOff := getBitmapOrFile value:#'menu.iconRadioOff' value:#'menu.iconRadioOff.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   768
    IconDisabledRadioOn := getBitmapOrFile value:#'menu.iconDisabledRadioOn' value:#'menu.iconDisabledRadioOn.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   769
    IconDisabledRadioOff := getBitmapOrFile value:#'menu.iconDisabledRadioOff' value:#'menu.iconDisabledRadioOff.bitmapFile'.
2752
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   770
2607
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   771
    "
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   772
     self updateStyleCache
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   773
    "
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   774
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   775
    "Modified: / 19-01-2012 / 13:17:59 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   776
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   777
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   778
!MenuPanel class methodsFor:'image registration'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   779
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   780
image:anImage onDevice:aDevice
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   781
"
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   782
Images := nil
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   783
"
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   784
    |deviceImages|
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   785
1156
6fa33dc93509 fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   786
    anImage device == aDevice ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   787
	^ anImage
1853
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   788
    ].
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   789
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   790
    Images isNil ifTrue:[ Images := WeakIdentityDictionary new ].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   791
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   792
    (deviceImages := Images at:aDevice ifAbsent:nil) isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   793
	Images at:aDevice put:(deviceImages := Dictionary new)
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   794
    ].
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   795
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   796
    ^ deviceImages at:anImage ifAbsentPut:[ |image|
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   797
	image := anImage copy onDevice:aDevice.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   798
	image clearMaskedPixels.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   799
	deviceImages at:anImage put:image.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   800
	image
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   801
    ].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   802
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   803
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   804
lightenedImage:anImage onDevice:aDevice
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   805
"
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   806
LigthenedImages := nil
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   807
"
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   808
    |deviceImages image colorMap|
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   809
1853
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   810
    LigthenedImages isNil ifTrue:[ LigthenedImages := WeakIdentityDictionary new ].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   811
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   812
    (deviceImages := LigthenedImages at:aDevice ifAbsent:nil) isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   813
	LigthenedImages at:aDevice put:(deviceImages := Dictionary new)
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   814
    ].
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   815
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   816
    (image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   817
	^ image
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   818
    ].
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   819
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   820
    colorMap := anImage perform:#colorMap ifNotUnderstood:nil.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   821
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   822
    colorMap notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   823
	image := anImage copy lightened onDevice:aDevice.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   824
	image clearMaskedPixels.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   825
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   826
	image := self image:anImage onDevice:aDevice
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   827
    ].
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   828
    deviceImages at:anImage put:image.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   829
    ^ image
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   830
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   831
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   832
!MenuPanel class methodsFor:'private'!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   833
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   834
subMenu:aSubMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   835
    "create a submenu; can be redifined in derived classes"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   836
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   837
    ^ (self new) menu:aSubMenu.
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   838
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   839
    "Modified: / 8.8.1998 / 02:13:11 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   840
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   841
4108
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   842
!MenuPanel class methodsFor:'utilities'!
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   843
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   844
processAmpersandCharactersFor:aLabel withAccessCharacterPosition:accessCharacterPositionOrNil
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   845
    "replace &x by the short-key attribute (i.e. remove & and underline x)
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   846
     The position is either specified by an accessCharacter position (useful if computed
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   847
     or fix), or by an ampersand escape.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   848
     Double ampersands are replaced by a single one."
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   849
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   850
    |i label nextChar rest pos size accessCharacter|
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   851
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   852
    pos := accessCharacterPositionOrNil.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   853
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   854
    label := aLabel.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   855
    size := aLabel size.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   856
    i := 1.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   857
    [((i := label indexOf:$& startingAt:i) ~~ 0 and:[i < size])] whileTrue:[
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   858
        nextChar := label at:(i+1).
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   859
        nextChar isSeparator ifTrue:[
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   860
            i := i + 1
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   861
        ] ifFalse:[
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   862
            rest := label copyFrom:(i+1).
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   863
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   864
            i == 1 ifTrue:[label := rest]
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   865
                  ifFalse:[label := (label copyFrom:1 to:(i-1)), rest].
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   866
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   867
            (label at:i) == $& ifTrue:[i := i + 1] ifFalse:[pos := i].
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   868
            size := size - 1.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   869
        ].
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   870
    ].
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   871
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   872
    (pos isNil or:[(accessCharacter := label at:pos ifAbsent:nil) isNil]) ifTrue:[
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   873
        ^ label
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   874
    ].
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   875
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   876
    label isText ifFalse:[
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   877
        label := Text string:label
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   878
    ].
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   879
    label emphasisAt:pos add:#underline.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   880
    ^ label
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   881
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   882
    "Created: / 15-02-2012 / 18:50:58 / cg"
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   883
! !
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   884
1808
e8628b502a49 methodCategory change
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   885
!MenuPanel methodsFor:'accepting'!
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   886
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   887
accept
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   888
    "accept the current selected item"
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   889
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   890
    |item|
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   891
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   892
    (item := self selection) isNil ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   893
        self topMenu
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   894
            openDelayed:nil;
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   895
            accept:nil.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   896
    ] ifFalse:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   897
        self acceptItem:item inMenu:self
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   898
    ]
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   899
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   900
    "Modified: / 29-06-2011 / 16:14:26 / cg"
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   901
!
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   902
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   903
accept:anItemOrNil
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   904
    "this is the topMenu: close the menu and accept the item (if not nil)"
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   905
4089
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
   906
    |itemAcceptedOrNil tgState itemIdx recv panel masterGroup winGrp focusView sensor|
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
   907
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   908
    self superMenu notNil ifTrue:[
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   909
        ^ self topMenu accept:anItemOrNil
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   910
    ].
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
   911
    prevFocusView ~~ self ifTrue:[
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   912
        focusView := prevFocusView.
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
   913
    ].
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
   914
    prevFocusView := nil.
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
   915
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
   916
    self openDelayed:nil.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   917
    self scrollActivity stop.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   918
    self selection:nil.
420
ca
parents: 417
diff changeset
   919
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   920
    (anItemOrNil notNil and:[anItemOrNil canAccept]) ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   921
        tgState := anItemOrNil toggleIndication.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   922
        panel := anItemOrNil menuPanel.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   923
        itemIdx := panel findFirst:[:el| el == anItemOrNil ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   924
        itemAcceptedOrNil := anItemOrNil.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   925
        recv := panel receiver.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   926
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   927
    self doUngrab:true.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   928
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   929
    winGrp := self windowGroup.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   930
510
8f77b9382066 bug fix with redraw
ca
parents: 505
diff changeset
   931
    self isPopUpView ifFalse:[
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   932
        self do:[:el| el updateIndicators].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   933
        winGrp notNil ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   934
            winGrp processExposeEvents.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   935
        ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   936
    ] ifTrue:[
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   937
        self unmap.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   938
        self device sync. "/ round trip - all expose events are now received
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   939
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   940
        winGrp notNil ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   941
            "/ give expose event a chance to arrive
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   942
            [shown and:[realized]] whileTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   943
                winGrp processExposeEventsFor:self
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   944
            ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   945
            masterGroup := winGrp previousGroup.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   946
        ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   947
        "/ cg: disabled-not needed - try PopUpList with destroy...
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   948
        "/ self destroy.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   949
        masterGroup notNil ifTrue:[masterGroup processExposeEvents].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   950
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   951
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   952
    (focusView notNil and:[winGrp notNil]) ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   953
        winGrp focusView:focusView.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   954
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   955
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   956
    itemAcceptedOrNil isNil ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   957
        hasPerformed := true.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   958
        self isPopUpView ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   959
            lastItem := itemAcceptedOrNil.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   960
        ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   961
        ^ itemAcceptedOrNil.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   962
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   963
4089
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
   964
"/ using master maingroup, sensor in my current windowgroup
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
   965
"/ flushes its events if the window goes
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
   966
winGrp notNil ifTrue:[
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
   967
    winGrp mainGroup notNil ifTrue:[
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
   968
        sensor := winGrp mainGroup sensor.
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
   969
    ].
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
   970
].
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
   971
sensor isNil ifTrue:[sensor := self sensor ].
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
   972
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
   973
    sensor pushEvent:(
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   974
        MenuEvent 
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   975
            selectMenuItem:itemAcceptedOrNil
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   976
            index:itemIdx 
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   977
            text:nil
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   978
            value:tgState
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   979
            inMenu:self
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   980
            menuReceiver:recv).
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   981
4053
dd0f1eb3e946 changed: #accept:
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
   982
    ^ anItemOrNil.  "/ stupid convention
dd0f1eb3e946 changed: #accept:
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
   983
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   984
"/    acceptAction := [ self accept:itemAcceptedOrNil index:itemIdx toggle:tgState receiver:recv ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   985
"/
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   986
"/    winGrpForBusyCursor := masterGroup ? winGrp.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   987
"/
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   988
"/    (itemAcceptedOrNil showBusyCursorWhilePerforming
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   989
"/    and:[winGrpForBusyCursor notNil])
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   990
"/    ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   991
"/        winGrpForBusyCursor withWaitCursorDo:acceptAction
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   992
"/    ] ifFalse:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   993
"/        acceptAction value
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   994
"/    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   995
4053
dd0f1eb3e946 changed: #accept:
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
   996
    "Modified: / 07-07-2011 / 18:08:41 / cg"
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   997
!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   998
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   999
accept:anItem index:anIndex toggle:aState receiver:aReceiver
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1000
    "really accept an item"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1001
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1002
    |selectorOrBlock argument numArgs isValueModel rec args arg2
1697
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  1003
     app master fallBack|
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1004
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1005
    isValueModel := aReceiver isValueModel.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1006
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1007
    hasPerformed := isValueModel.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1008
3558
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
  1009
    (selectorOrBlock := anItem value) isNil ifTrue:[
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1010
        ^ self "/ ^ anIndex
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1011
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1012
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1013
    (argument := anItem argument) isNil ifTrue:[
4033
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1014
        argument := aState ? anItem
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1015
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1016
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1017
    (selectorOrBlock isSymbol or:[selectorOrBlock isArray]) ifFalse:[
4033
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1018
        "/ a valueHolder or block
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1019
        (selectorOrBlock respondsTo:#valueWithArguments:) ifFalse:[
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1020
             ^ self "/ ^ selectorOrBlock
4033
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1021
        ].
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1022
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1023
        numArgs := selectorOrBlock perform:#numArgs ifNotUnderstood:0.
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1024
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1025
        numArgs == 0 ifTrue:[
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1026
            args := nil
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1027
        ] ifFalse:[
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1028
            numArgs == 1 ifTrue:[
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1029
                args := Array with:argument
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1030
            ] ifFalse:[
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1031
                args := Array with:argument with:self
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1032
            ]
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1033
        ].
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1034
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1035
        selectorOrBlock valueWithArguments:args.
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1036
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1037
        hasPerformed := true.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1038
        ^ self "/ ^ anIndex
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1039
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1040
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1041
    anItem sendToOriginator ifTrue:[
4033
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1042
        rec := self originator.
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1043
        rec isNil ifTrue:[
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1044
            self error:'no originating widget (no target for message)' mayProceed:true.
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1045
        ].
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1046
    ] ifFalse:[
4033
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1047
        rec := aReceiver
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1048
    ].
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1049
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1050
    rec isNil ifTrue:[
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1051
        ^ self "/ ^ selectorOrBlock
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1052
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1053
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1054
    isValueModel ifTrue:[
4033
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1055
        rec value:selectorOrBlock
465
67a0f3dd503a in case of performing a selector '0' is returned
ca
parents: 464
diff changeset
  1056
    ] ifFalse:[
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1057
        selectorOrBlock isArray ifTrue:[
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1058
            "/ a hack !!!!!! Must be compatible to old MenuView
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1059
            args := selectorOrBlock copyFrom:2.
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1060
            selectorOrBlock := selectorOrBlock first.
4033
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1061
        ] ifFalse:[
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1062
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1063
            arg2 := self.
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1064
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1065
            "/ support for ST80 style applications
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1066
            "/ (expecting the message to go to the application
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1067
            "/  if not understood by the view)
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1068
            "/ These expect the controller to be passed as argument.
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1069
            "/ sigh.
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1070
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1071
            (rec isView
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1072
            and:[(rec respondsTo:selectorOrBlock) not
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1073
            and:[(app := rec application) ~~ rec
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1074
            and:[app notNil]]]) ifTrue:[
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1075
                arg2 := rec controller.       "/ the Views controller
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1076
                rec := app.
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1077
            ].
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1078
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1079
            (numArgs := selectorOrBlock numArgs) == 0 ifTrue:[
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1080
                args := nil
4033
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1081
            ] ifFalse:[
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1082
                numArgs == 1 ifTrue:[
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1083
                    args := Array with:argument
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1084
                ] ifFalse:[
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1085
                    args := Array with:argument with:arg2
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1086
                ]
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1087
            ].
4033
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1088
        ].
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1089
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1090
        fallBack :=
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1091
            [
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1092
                |val|
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1093
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1094
                "/ mhmh - the receiver did not respond to that message;
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1095
                "/ if there is a master-application, try that one
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1096
                "/ (recursive)
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1097
                master := rec perform:#masterApplication ifNotUnderstood:nil.
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1098
                master notNil ifTrue:[
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1099
                    rec := master.
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1100
                    val := rec perform:selectorOrBlock withArguments:args ifNotUnderstood:fallBack
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1101
                ] ifFalse:[
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1102
                    self
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1103
                        error:'unimplemented (or error in) menu message: ' , selectorOrBlock
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1104
                        mayProceed:true.
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1105
                    val := nil.
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1106
                ].
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1107
                val
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1108
            ].
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1109
2d2492fd2805 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  1110
        rec perform:selectorOrBlock withArguments:args ifNotUnderstood:fallBack.
420
ca
parents: 417
diff changeset
  1111
    ].
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1112
    hasPerformed := true.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1113
    ^ self "/ ^ selectorOrBlock
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1114
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1115
    "Modified: / 06-03-2012 / 14:49:00 / cg"
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1116
!
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1117
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1118
acceptItem:anItemOrNil inMenu:aMenu
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  1119
    |tgState topMenu|
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  1120
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  1121
    topMenu := self topMenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  1122
    topMenu openDelayed:nil.
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1123
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1124
    (anItemOrNil isNil or:[anItemOrNil hideMenuOnActivated]) ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1125
        topMenu accept:anItemOrNil
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1126
    ] ifFalse:[
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1127
        anItemOrNil canAccept ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1128
            tgState := anItemOrNil toggleIndication.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1129
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1130
            self 
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1131
                accept:anItemOrNil
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1132
                index:(aMenu selectionIndex)
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1133
                toggle:tgState
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1134
                receiver:(aMenu receiver).
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1135
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1136
            aMenu do:[:el| el updateIndicators].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1137
            anItemOrNil hideMenuOnActivated ifFalse:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1138
                aMenu invalidate
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1139
            ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1140
        ]
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1141
    ]
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1142
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1143
    "Modified: / 29-06-2011 / 14:34:45 / cg"
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1144
!
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1145
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1146
lastItemAccepted
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1147
    "returns last item selected or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1148
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1149
  ^ lastItem
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1150
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1151
    "Modified: / 29-06-2011 / 16:24:48 / cg"
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1152
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1153
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1154
lastValueAccepted
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1155
    "returns last value accepted or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1156
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1157
    ^ self lastItemAccepted value
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1158
! !
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1159
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1160
!MenuPanel methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1161
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1162
accessCharacterPositionAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1163
    "get the access character position for a textLabel"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1164
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1165
    ^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1166
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1167
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1168
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1169
    "get the access character position for a textLabel"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1170
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1171
    self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1172
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1173
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1174
accessCharacterPositions
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1175
    "returns a collection of accessCharacterPositions or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1176
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1177
    ^ self collect:[:anItem| anItem accessCharacterPosition ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1178
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1179
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1180
accessCharacterPositions:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1181
    "define accessCharacterPositions for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1182
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1183
    self onEachPerform:#accessCharacterPosition: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1184
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1185
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1186
args
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1187
    "returns a collection of arguments or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1188
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1189
    ^ self collect:[:anItem| anItem argument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1190
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1191
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1192
args:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1193
    "define arguments for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1194
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1195
    self onEachPerform:#argument: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1196
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1197
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1198
argsAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1199
    "gets the argument of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1200
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1201
    ^ self itemAt:stringOrNumber do:[:el| el argument ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1202
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1203
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1204
argsAt:stringOrNumber put:anArgument
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1205
    "sets the argument of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1206
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1207
    self itemAt:stringOrNumber do:[:el| el argument:anArgument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1208
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1209
3332
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1210
doAccessCharacterTranslation
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1211
    "true if &-chars in a label are to be treated as accessCharacter indicators.
3958
9b7f4a444c40 comments
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
  1212
     Can be set to false to leave accessCharacter unchanged"
3332
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1213
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1214
    ^ doAccessCharacterTranslation ? true
3958
9b7f4a444c40 comments
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
  1215
9b7f4a444c40 comments
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
  1216
    "Modified: / 02-11-2010 / 10:19:09 / cg"
3332
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1217
!
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1218
3328
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1219
doAccessCharacterTranslation:aBoolean
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1220
    "true if &-chars in a label are to be treated as accessCharacter indicators.
3958
9b7f4a444c40 comments
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
  1221
     Can be set to false to leave accessCharacter unchanged"
3328
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1222
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1223
    doAccessCharacterTranslation := aBoolean
3958
9b7f4a444c40 comments
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
  1224
9b7f4a444c40 comments
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
  1225
    "Modified: / 02-11-2010 / 10:19:14 / cg"
3328
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1226
!
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1227
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1228
enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1229
    "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
  1230
     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
  1231
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1232
    ^ enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1233
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1234
    "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
  1235
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1236
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1237
groupSizes
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1238
    "gets collection of group sizes"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1239
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1240
  ^ groupSizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1241
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1242
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1243
groupSizes:aGroupSizes
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1244
    "sets collection of group sizes"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1245
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1246
    aGroupSizes = groupSizes ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1247
	groupSizes := aGroupSizes copy.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1248
	self mustRearrange.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1249
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1250
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1251
2731
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1252
hideOnRelease
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1253
    ^ hideOnRelease
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1254
!
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1255
3725
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1256
hideOnRelease:aBoolean
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1257
    hideOnRelease := aBoolean
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1258
!
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1259
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1260
labelAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1261
    "gets the label of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1262
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1263
  ^ self itemAt:stringOrNumber do:[:el| el label ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1264
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1265
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1266
labelAt:stringOrNumber put:aLabel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1267
    "sets the label of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1268
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1269
    self itemAt:stringOrNumber do:[:el| el label:aLabel ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1270
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1271
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1272
labels
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1273
    "returns a collection of labels's or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1274
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1275
    ^ self collect:[:anItem| anItem label ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1276
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1277
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1278
labels:labels
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1279
    "define labels for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1280
2118
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  1281
    |size|
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  1282
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1283
    self disabledRedrawDo:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1284
	self removeAll.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1285
	size := labels size.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1286
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1287
	size > 0 ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1288
	    items := OrderedCollection new:size.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1289
	    labels do:[:aLabel| items add:(Item in:self label:aLabel) ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1290
	]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1291
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1292
!
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1293
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1294
menuPerformer:anObject
1999
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1295
    "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
  1296
     from all submenus no specific receiver is defined )."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1297
1999
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1298
    ^ self receiver:anObject
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1299
!
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1300
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1301
nameKeyAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1302
    "gets the nameKey of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1303
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1304
    ^ self itemAt:stringOrNumber do:[:el| el nameKey ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1305
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1306
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1307
nameKeyAt:stringOrNumber put:aNameKey
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1308
    "sets the nameKey of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1309
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1310
    self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1311
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1312
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1313
nameKeys
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1314
    "returns a collection of nameKeyss or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1315
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1316
    ^ self collect:[:anItem| anItem nameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1317
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1318
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1319
nameKeys:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1320
    "define nameKeys for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1321
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1322
    self onEachPerform:#nameKey: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1323
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1324
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1325
numberOfItems
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1326
    "gets number of items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1327
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1328
    ^ items size
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1329
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1330
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1331
originator
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1332
    originator notNil ifTrue:[^ originator].
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1333
    superMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1334
	^ superMenu originator
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1335
    ].
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1336
    ^ nil
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1337
!
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1338
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1339
receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1340
    "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
  1341
     from all submenus no specific receiver is defined )."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1342
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1343
    (receiver isNil and:[superMenu notNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1344
	^ superMenu receiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1345
    ].
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1346
  ^ receiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1347
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1348
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1349
receiver:anObject
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1350
    "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
  1351
     from all submenus no specific receiver is defined )."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1352
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1353
    receiver := anObject
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1354
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1355
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1356
shortcutKeyAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1357
    "gets the shortCutKey of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1358
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1359
    ^ self itemAt:stringOrNumber do:[:el| el shortcutKey ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1360
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1361
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1362
shortcutKeyAt:stringOrNumber put:aKey
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1363
    "sets the shortCutKey of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1364
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1365
    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
  1366
!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1367
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1368
shortcutKeys
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1369
    "returns a collection of shortcutKeys or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1370
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1371
    ^ self collect:[:anItem| anItem shortcutKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1372
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1373
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1374
shortcutKeys:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1375
    "define shortcutKeys for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1376
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1377
    self onEachPerform:#shortcutKey: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1378
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1379
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1380
valueAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1381
    "gets value of an item; a block, valueHolder, ..."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1382
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1383
    ^ self itemAt:stringOrNumber do:[:el| el value ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1384
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1385
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1386
valueAt:stringOrNumber put:someThing
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1387
    "sets value of an item; a block, valueHolder, ..."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1388
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1389
    self itemAt:stringOrNumber do:[:el| el value:someThing ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1390
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1391
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1392
values:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1393
    "define values for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1394
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1395
    self onEachPerform:#value: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1396
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1397
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1398
!MenuPanel methodsFor:'accessing-behavior'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1399
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1400
disableAll
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1401
    "disable all items; not the menu in case of enabled"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1402
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1403
    self do:[:anItem| anItem enabled:false]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1404
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1405
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1406
disableAll:collectionOfIndicesOrNames
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1407
    "disable an collection of items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1408
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1409
    collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1410
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1411
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1412
enableAll
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1413
    "enable all items; not the menu in case of disabled"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1414
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1415
    self do:[:anItem| anItem enabled:true]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1416
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1417
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1418
enableAll:collectionOfIndicesOrNames
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1419
    "enable an collection of items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1420
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1421
    collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1422
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1423
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1424
enabled
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1425
    "returns enabled state"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1426
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1427
    ^ enabled
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1428
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1429
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1430
enabled:aState
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1431
    "change enabled state of menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1432
545
d01d14358b07 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 524
diff changeset
  1433
    |state|
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1434
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1435
    state := aState ? true.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1436
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  1437
    enabled ~~ state ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1438
	enabled := state.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1439
	self invalidate.
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1440
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1441
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1442
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1443
enabledAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1444
    "gets the enabled state of an item or false"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1445
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1446
  ^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1447
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1448
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1449
enabledAt:stringOrNumber put:aState
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1450
    "sets the enabled state of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1451
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1452
    self itemAt:stringOrNumber do:[:el| el enabled:aState ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1453
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1454
3725
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1455
exclusivePointer:aBoolean
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1456
    "Do nothing here. Compatibility with PopUpListController"
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1457
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1458
    ^ self
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1459
!
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1460
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1461
isEnabled:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1462
    "gets the enabled state of an item or false"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1463
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1464
    ^ self enabledAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1465
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1466
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1467
!MenuPanel methodsFor:'accessing-channels'!
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1468
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1469
enableChannel:aValueHolder
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1470
    "set my enableChannel"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1471
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1472
    enableChannel notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1473
	enableChannel removeDependent:self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1474
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1475
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1476
    (enableChannel := aValueHolder) notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1477
	enableChannel addDependent:self.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1478
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1479
    self enabled:(enableChannel value).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1480
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1481
3222
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1482
menuChannel
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1483
    ^ self menuHolder
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1484
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1485
    "Created: / 27-03-2007 / 08:38:31 / cg"
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1486
!
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1487
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1488
menuHolder:aValueHolder
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1489
    "set my menuHolder"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1490
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1491
    menuHolder notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1492
	menuHolder removeDependent:self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1493
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1494
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1495
    (menuHolder := aValueHolder) notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1496
	menuHolder addDependent:self.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1497
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1498
    self menu:(menuHolder value)
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1499
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1500
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1501
!MenuPanel methodsFor:'accessing-color & font'!
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1502
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1503
activeBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1504
    "get the background drawing color used to highlight selection"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1505
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1506
    ^ styleSheet colorAt:#'menuPanel.activeBackgroundColor'
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1507
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1508
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1509
activeForegroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1510
    "get the foreground color used to highlight selections"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1511
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1512
    ^ styleSheet colorAt:#'menuPanel.activeForegroundColor'
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1513
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1514
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1515
backgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1516
    "return the background color"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1517
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  1518
    ^ super viewBackground
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1519
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1520
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1521
backgroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1522
    "set the background drawing color. You should not use this method;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1523
     instead, leave the value as defined in the styleSheet."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1524
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1525
    self backgroundColor ~~ aColor ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1526
	super viewBackground:aColor.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1527
	self invalidate "/ RepairNow:true
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1528
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1529
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1530
    "Modified: / 6.6.1998 / 19:50:06 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1531
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1532
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1533
buttonActiveBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1534
    "get the background drawing color used to highlight button selection"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1535
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1536
    ^ buttonActiveBackgroundColor ? viewBackground
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1537
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1538
    "Modified: / 19-01-2012 / 11:51:46 / cg"
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1539
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1540
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1541
buttonActiveForegroundColor
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1542
    "get the foreground drawing color used to highlight button selection"
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1543
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1544
    ^ styleSheet colorAt:#'button.activeForegroundColor'
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1545
		 default:(self foregroundColor)
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1546
!
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1547
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1548
buttonEdgeStyle
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1549
    "get the button edge style"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1550
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1551
    ^ styleSheet at:#'button.edgeStyle'
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1552
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1553
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1554
buttonEnteredBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1555
    "get the background drawing color used to highlight entered button items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1556
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1557
    ^ buttonEnteredBackgroundColor ? viewBackground
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1558
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1559
    "Modified: / 19-01-2012 / 11:52:17 / cg"
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1560
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1561
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1562
buttonEnteredLevel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1563
    "get the 3D-level used to highlight entered button items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1564
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1565
    ^ styleSheet at:#'menuPanel.buttonEnteredLevel'
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1566
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1567
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1568
buttonHalfLightColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1569
    "get the background drawing color used to half light button frame"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1570
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1571
    ^ styleSheet colorAt:#'button.halfLightColor'
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1572
!
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
buttonHalfShadowColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1575
    "get the background drawing color used to half shadow button frame"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1576
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1577
    ^ styleSheet colorAt:#'button.halfShadowColor'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1578
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1579
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1580
buttonLightColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1581
    "get the background drawing color used to light button frame"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1582
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1583
    ^ styleSheet colorAt:#'menuPanel.buttonLightColor'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1584
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1585
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1586
buttonPassiveBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1587
    "get the background drawing color used for button"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1588
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1589
    ^ buttonPassiveBackgroundColor ? viewBackground
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1590
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1591
    "Modified: / 19-01-2012 / 13:13:59 / cg"
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1592
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1593
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1594
buttonShadowColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1595
    "get the background drawing color used to shadow button frame"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1596
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1597
    ^ styleSheet colorAt:#'menuPanel.buttonShadowColor'
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1598
!
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1599
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1600
disabledEtchedForegroundColor
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1601
    "return the color used for etching disabled items.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1602
     If nil, no 3D effect is drawn."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1603
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1604
    ^ styleSheet colorAt:#'menuPanel.disabledEtchedFgColor'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1605
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1606
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1607
disabledForegroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1608
    "return the foreground color used by disabled items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1609
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1610
    ^ styleSheet colorAt:#'menuPanel.disabledForegroundColor'
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1611
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1612
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1613
enteredBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1614
    "return the background color for entered items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1615
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1616
    ^ styleSheet colorAt:#'menu.enteredBackgroundColor'
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1617
		 default:(self backgroundColor)
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1618
!
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1619
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1620
enteredForegroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1621
    "return the foreground color for entered items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1622
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1623
    ^ styleSheet colorAt:#'menu.enteredForegroundColor' default:fgColor
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1624
!
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1625
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1626
font:aFont
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1627
    "set the font"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1628
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1629
    (aFont isNil or:[aFont = font]) ifTrue:[ ^ self ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1630
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1631
    super font:aFont.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1632
    self do:[:anItem| anItem fontChanged ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1633
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1634
    (shown and:[superMenu notNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1635
	self extent:(self preferredExtent)
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1636
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1637
    self mustRearrange.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1638
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1639
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1640
foregroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1641
    "return the passive foreground color"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1642
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1643
    ^ fgColor
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1644
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1645
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1646
foregroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1647
    "set the foregroundColor drawing color. You should not use this method;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1648
     instead leave the value as defined in the styleSheet."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1649
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1650
    aColor ~= fgColor ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1651
	fgColor := aColor onDevice:device.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1652
	self invalidate
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1653
    ].
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  1654
!
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  1655
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1656
maxAbsoluteButtonLevel
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1657
    "returns the maximum absolute button level; used to compute the preferred
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1658
     extent of a button"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1659
3987
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  1660
    ^ (styleSheet at:#'menuPanel.maxAbsoluteButtonLevel') ? 0
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  1661
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  1662
    "Modified: / 19-01-2011 / 21:21:53 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1663
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1664
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1665
selectionFrameBrightColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1666
    "get the selection frame bright color"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1667
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1668
    ^ Color white
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1669
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1670
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1671
selectionFrameDarkColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1672
    "get the selection frame dark color"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1673
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1674
    ^ Color black
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1675
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1676
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1677
setFont:aFont
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1678
    "set the font if the argument is nonNil;
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  1679
     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
  1680
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1681
    |currentFont|
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1682
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1683
    (aFont notNil and:[aFont ~= font]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1684
	currentFont := font.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1685
	super font:aFont.
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1686
    ].
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1687
    ^ currentFont
2761
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  1688
!
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  1689
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  1690
viewBackground:aColor
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  1691
    super viewBackground:aColor
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1692
! !
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1693
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1694
!MenuPanel methodsFor:'accessing-dimensions'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1695
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1696
height
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1697
    "default height"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1698
3886
68183511e7ef code deobfuscated:
Claus Gittinger <cg@exept.de>
parents: 3881
diff changeset
  1699
    self hasExplicitExtent ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1700
	^ self preferredHeight
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1701
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1702
    ^ super height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1703
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1704
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1705
maxExtent
4113
9172e1e60149 changed: #maxExtent
Stefan Vogel <sv@exept.de>
parents: 4112
diff changeset
  1706
    |minH pos|
4110
e5d8fe91874e class definition
Claus Gittinger <cg@exept.de>
parents: 4109
diff changeset
  1707
e5d8fe91874e class definition
Claus Gittinger <cg@exept.de>
parents: 4109
diff changeset
  1708
    maxExtent notNil ifTrue:[^ maxExtent].
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1709
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1710
    device notNil ifTrue:[
4109
ed4578d2f007 changed: #maxExtent
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
  1711
        "/ notice, the position-dependent query: if there is a higher secondary screen,
ed4578d2f007 changed: #maxExtent
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
  1712
        "/ this makes a difference in where a popUpMenu is allowed...
4110
e5d8fe91874e class definition
Claus Gittinger <cg@exept.de>
parents: 4109
diff changeset
  1713
        pos := self origin.
e5d8fe91874e class definition
Claus Gittinger <cg@exept.de>
parents: 4109
diff changeset
  1714
        pos = (0@0) ifTrue:[
e5d8fe91874e class definition
Claus Gittinger <cg@exept.de>
parents: 4109
diff changeset
  1715
            "called too early"
4113
9172e1e60149 changed: #maxExtent
Stefan Vogel <sv@exept.de>
parents: 4112
diff changeset
  1716
            minH := device smallestMonitorHeight.
9172e1e60149 changed: #maxExtent
Stefan Vogel <sv@exept.de>
parents: 4112
diff changeset
  1717
        ] ifFalse:[
9172e1e60149 changed: #maxExtent
Stefan Vogel <sv@exept.de>
parents: 4112
diff changeset
  1718
            minH := device usableHeightAt:pos.
4109
ed4578d2f007 changed: #maxExtent
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
  1719
        ].
ed4578d2f007 changed: #maxExtent
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
  1720
        ^ device usableWidth @ (minH - 2)
ed4578d2f007 changed: #maxExtent
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
  1721
        "/ ^ device usableExtent - 5.
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1722
    ].
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1723
    superMenu notNil ifTrue:[
4109
ed4578d2f007 changed: #maxExtent
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
  1724
        ^ superMenu maxExtent
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1725
    ].
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1726
    "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
  1727
    self error:'don''t know maxExtent'.
4109
ed4578d2f007 changed: #maxExtent
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
  1728
4110
e5d8fe91874e class definition
Claus Gittinger <cg@exept.de>
parents: 4109
diff changeset
  1729
    "Modified: / 15-02-2012 / 19:22:24 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1730
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1731
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1732
preferredExtent
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1733
    "compute and returns my preferred extent"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1734
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1735
    |maxExtent usedExtent|
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1736
3580
e9fe446dc779 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3565
diff changeset
  1737
    "/ If I have an explicit preferredExtent..
e9fe446dc779 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3565
diff changeset
  1738
    explicitExtent notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1739
	^ explicitExtent
3580
e9fe446dc779 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3565
diff changeset
  1740
    ].
e9fe446dc779 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3565
diff changeset
  1741
    "/ If I have a cached preferredExtent value..
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1742
    preferredExtent notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1743
	^ preferredExtent
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1744
    ].
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  1745
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1746
    usedExtent := self preferredExtentOfItems.
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1747
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1748
    superView isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1749
	"/ is standalone
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1750
	preferredWidth notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1751
	    usedExtent x < preferredWidth ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1752
		usedExtent := preferredWidth @ usedExtent y.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1753
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1754
	]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1755
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1756
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1757
    maxExtent := self maxExtent.
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1758
    maxExtent notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1759
	usedExtent := usedExtent min:maxExtent.
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1760
    ].
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  1761
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  1762
    preferredExtent := usedExtent.
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1763
    ^ usedExtent
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1764
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1765
    "Modified: / 10.10.2001 / 14:57:25 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1766
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1767
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1768
preferredExtentOfItems
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1769
    "compute and returns my preferred extent including all items
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1770
	!!!!!! changes have influence on method #rearrangeItems !!!!!!"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1771
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1772
    |hasMenu shCtKey extent showAcc sck
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1773
     x            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1774
     y            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1775
     size         "{ Class:SmallInteger }"
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1776
     buttonInsetX2 "{ Class:SmallInteger }"
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1777
     buttonInsetY2 "{ Class:SmallInteger }"
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1778
     labelInsetX  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1779
     labelInsetY  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1780
     itemMargin   "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1781
     groupDividerSize "{ Class:SmallInteger }"
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  1782
    |
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1783
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1784
    (size := items size) == 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1785
	self isViewWrapper ifTrue:[ ^ subViews first extent ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1786
	^ 32 @ 32
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1787
    ].
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1788
    stringOffsetX := nil.
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1789
    buttonInsetX2 := 2 * buttonInsetX.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1790
    buttonInsetY2 := 2 * buttonInsetY.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1791
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1792
    self isPopUpView ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1793
	labelInsetX := labelInsetY := 2 * (self enteredLevel abs).
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1794
    ] ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1795
	labelInsetX := labelInsetY := 0.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1796
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1797
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1798
    x := 0.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1799
    y := 0.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1800
    groupDividerSize := self groupDividerSize.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1801
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1802
    self verticalLayout ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1803
	items keysAndValuesDo:[:key :el| |eX eY|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1804
	    extent := el preferredExtent.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1805
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1806
	    "/ check for visibility (extent x ~~ 0)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1807
	    (eX := extent x) ~~ 0 ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1808
		eY := extent y.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1809
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1810
		el isButton ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1811
		    eX := eX + buttonInsetX2.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1812
		    eY := eY + buttonInsetY2.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1813
		] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1814
		    eX := eX + labelInsetX.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1815
		    eY := eY + labelInsetY.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1816
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1817
		key ~~ size ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1818
		    (self hasGroupDividerAt:key) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1819
			x := x + groupDividerSize
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1820
		    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1821
			el needsItemSpaceWhenDrawing ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1822
			    x := x + itemSpace
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1823
			]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1824
		    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1825
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1826
		x := x + eX.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1827
		y := y max:eY.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1828
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1829
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1830
    ] ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1831
	hasMenu := false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1832
	shCtKey := 0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1833
	showAcc := MenuView showAcceleratorKeys == true.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1834
	y := x.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1835
	x := 0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1836
	itemMargin := 2 * self itemMargin.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1837
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1838
	items keysAndValuesDo:[:key :el| |eX eY|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1839
	    extent := el preferredExtent.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1840
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1841
	    "/ check for visibility (extent x ~~ 0)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1842
	    (eX := extent x) ~~ 0 ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1843
		eY := extent y.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1844
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1845
		el isButton ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1846
		    eX := eX + buttonInsetX2.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1847
		    eY := eY + buttonInsetY2.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1848
		] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1849
		    eX := eX + labelInsetX.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1850
		    eY := eY + labelInsetY.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1851
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1852
		hasMenu ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1853
		    hasMenu := el hasSubmenu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1854
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1855
		(showAcc and:[(sck := el shortcutKeyAsString) notNil]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1856
		    shCtKey := shCtKey max:(sck widthOn:self)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1857
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1858
		key ~~ size ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1859
		    (self hasGroupDividerAt:key) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1860
			y := y + groupDividerSize
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1861
		    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1862
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1863
		y := y + eY.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1864
		x := x max:eX.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1865
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1866
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1867
	x := x + itemMargin.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1868
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1869
	(hasMenu or:[shCtKey ~~ 0]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1870
	    shortKeyInset := x + Item labelRightOffset.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1871
	    x := shortKeyInset + shCtKey + self subMenuIndicationWidth.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1872
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1873
	    (shCtKey ~~ 0 and:[hasMenu]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1874
		x := x + self shortcutKeyOffset.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1875
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1876
	].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1877
"/ to have a small inset
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1878
	y := y + 1.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1879
"/        x := x + 1.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1880
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1881
    x := x + margin + margin.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1882
    y := y + margin + margin.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1883
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  1884
    ^ x @ y
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1885
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1886
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1887
preferredWidth:aWidthOrNil
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1888
    "used for example by combo box to setup the preferred width for the popup menu.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1889
     If nil (default), the width is computed from the contained items.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1890
     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
  1891
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1892
    preferredWidth := aWidthOrNil.
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1893
!
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1894
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1895
shortKeyInset
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1896
    "left inset of shortcutKey"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1897
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1898
    ^ shortKeyInset
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1899
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1900
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1901
stringOffsetXfor:anItem
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1902
    "return the x offset for a MenuItem where to draw the text
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1903
    "
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1904
    |label w|
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1905
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1906
    anItem isButton ifTrue:[ ^ 0 ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1907
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1908
    stringOffsetX isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1909
	stringOffsetX := 0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1910
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1911
	(self isPopUpView and:[self verticalLayout]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1912
	    self do:[:el|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1913
		el isVisible ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1914
		    (    (label := el indicatorForm) notNil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1915
		     or:[(label := el choiceForm) notNil]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1916
		    ) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1917
			stringOffsetX := stringOffsetX max:(label width + 2).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1918
		    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1919
			label := el displayLabel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1920
			label class == LabelAndIcon ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1921
			    stringOffsetX := stringOffsetX max:(label xOfString).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1922
			].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1923
		    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1924
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1925
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1926
	].
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1927
    ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1928
    w := 0.
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1929
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1930
    (    (label := anItem indicatorForm) notNil
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1931
     or:[(label := anItem choiceForm) notNil]
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1932
    ) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1933
	w := label width + 2.
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1934
    ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1935
    stringOffsetX == 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1936
	^ w
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1937
    ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1938
    w == 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1939
	label := anItem displayLabel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1940
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1941
	label class == LabelAndIcon ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1942
	    ^ stringOffsetX - label xOfString
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1943
	].
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1944
    ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1945
    ^ stringOffsetX.
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1946
!
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1947
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1948
subMenuIndicationWidth
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1949
    ^ self rightArrow width
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1950
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1951
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1952
!MenuPanel methodsFor:'accessing-interactors'!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1953
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1954
iconIndicationDisabledOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1955
    ^ self registerImageOnDevice:(self class iconIndicationDisabledOff)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1956
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1957
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1958
iconIndicationDisabledOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1959
    ^ self registerImageOnDevice:(self class iconIndicationDisabledOn)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1960
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1961
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1962
iconIndicationOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1963
    ^ self registerImageOnDevice:(self class iconIndicationOff)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1964
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1965
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1966
iconIndicationOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1967
    ^ self registerImageOnDevice:(self class iconIndicationOn)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1968
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1969
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1970
iconRadioGroupDisabledOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1971
    ^ self registerImageOnDevice:(self class iconRadioGroupDisabledOff)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1972
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1973
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1974
iconRadioGroupDisabledOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1975
    ^ self registerImageOnDevice:(self class iconRadioGroupDisabledOn)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1976
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1977
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  1978
iconRadioGroupEnteredOff
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  1979
    ^ self registerImageOnDevice:(self class iconRadioGroupEnteredOff)
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  1980
!
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  1981
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  1982
iconRadioGroupEnteredOn
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  1983
    ^ self registerImageOnDevice:(self class iconRadioGroupEnteredOn)
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  1984
!
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  1985
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1986
iconRadioGroupOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1987
    ^ self registerImageOnDevice:(self class iconRadioGroupOff)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1988
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1989
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1990
iconRadioGroupOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1991
    ^ self registerImageOnDevice:(self class iconRadioGroupOn)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1992
! !
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1993
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1994
!MenuPanel methodsFor:'accessing-items'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1995
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1996
itemAt:stringOrNumber do:aOneArgBlock
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1997
    "evaluate the 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
  1998
     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
  1999
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2000
    ^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2001
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2002
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2003
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2004
    "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
  2005
     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
  2006
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2007
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2008
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2009
    item := self itemAt:stringOrNumber.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2010
    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
  2011
    ^ exceptionBlock value
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2012
!
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2013
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2014
itemAtIndex:anIndex
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2015
    "returns item at an index or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2016
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2017
    ^ 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
  2018
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  2019
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  2020
items
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2021
    "returns the list of items or nil.
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2022
     Warning: do not change this list - it is mine !!"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2023
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  2024
    ^ items
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2025
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2026
    "Modified: / 09-11-2010 / 10:10:40 / cg"
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2027
!
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2028
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2029
itemsDo:aBlock
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2030
    items notNil ifTrue:[
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2031
        items do:aBlock
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2032
    ]
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2033
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2034
    "Created: / 09-11-2010 / 10:05:54 / cg"
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2035
!
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2036
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2037
itemsDoWithIndex:aBlock
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2038
    items notNil ifTrue:[
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2039
        items doWithIndex:aBlock
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2040
    ]
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2041
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2042
    "Created: / 09-11-2010 / 10:06:02 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2043
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2044
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  2045
!MenuPanel methodsFor:'accessing-look'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2046
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  2047
buttonActiveLevel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2048
    "get the buttons active level"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2049
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2050
    ^ styleSheet at:#'menuPanel.buttonActiveLevel'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  2051
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  2052
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  2053
buttonPassiveLevel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2054
    "get the buttons passive level"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2055
3987
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  2056
    ^ (styleSheet at:#'menuPanel.buttonPassiveLevel') ? 0
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  2057
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  2058
    "Modified: / 19-01-2011 / 21:21:26 / cg"
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  2059
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  2060
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2061
centerItems
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2062
    ^ centerItems ? false
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2063
!
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2064
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2065
centerItems:aBoolean
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2066
    centerItems := aBoolean
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2067
!
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2068
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2069
fitFirstPanel
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2070
    "gets true if the first panel in the menu hierarchy must be fit
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2071
     to the extent of its superView
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2072
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2073
     NOT SUPPORTED"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2074
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2075
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2076
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2077
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2078
fitFirstPanel:aState
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2079
    "sets true if the first panel in the menu hierarchy must be fit
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2080
     to the extent of its superView
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2081
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2082
     NOT SUPPORTED"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2083
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2084
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  2085
level:anInt
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  2086
    anInt ~~ level ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  2087
	super level:anInt.
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  2088
	self mustRearrange
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  2089
    ]
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2090
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2091
    "Modified: / 15.11.2001 / 17:42:07 / cg"
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  2092
!
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  2093
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2094
rightArrow
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  2095
    rightArrow isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2096
	device isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2097
	    ^ SelectionInListView rightArrowFormOn:Display
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2098
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2099
	rightArrow := SelectionInListView rightArrowFormOn:device
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2100
    ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2101
    ^ rightArrow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2102
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2103
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2104
rightArrowShadow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2105
    ^ rightArrowShadow
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2106
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2107
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2108
showGroupDivider
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2109
    "get the enabled flag for showing groupDiveders"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2110
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2111
    ^ showGroupDivider
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2112
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2113
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2114
showGroupDivider:aState
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2115
    "set the enabled flag for showing groupDiveders"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2116
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2117
    showGroupDivider ~~ aState ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2118
	showGroupDivider := aState.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2119
	self mustRearrange.
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2120
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2121
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2122
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2123
showSeparatingLines
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2124
    "gets true if drawing of separating lines is enabled."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2125
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2126
    ^ showSeparatingLines
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2127
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2128
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2129
showSeparatingLines:aState
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2130
    "turn on/off drawing of separating lines."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2131
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2132
    aState ~~ showSeparatingLines ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2133
	showSeparatingLines := aState.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2134
	self mustRearrange
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2135
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2136
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2137
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2138
verticalLayout
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2139
    "get the layout: vertical( true ) or horizontal( false )"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2140
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  2141
    verticalLayout notNil ifTrue:[ ^ verticalLayout ].
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2142
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2143
    superMenu notNil ifTrue:[ verticalLayout := true ]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2144
		    ifFalse:[ verticalLayout := self isPopUpView ].
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  2145
    ^ verticalLayout
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2146
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2147
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2148
verticalLayout:aState
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2149
    "set the layout: vertical( true ) or horizontal( false )"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2150
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2151
    aState ~~ verticalLayout ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2152
	verticalLayout isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2153
	    verticalLayout := aState
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2154
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2155
	    verticalLayout := aState.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2156
	    self mustRearrange.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2157
	].
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2158
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2159
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2160
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2161
!MenuPanel methodsFor:'accessing-style'!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2162
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2163
buttonInsetX
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2164
    "returns the verical button space"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2165
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  2166
    ^ buttonInsetX
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2167
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2168
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2169
buttonInsetY
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2170
    "returns the verical button space"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2171
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  2172
    ^ buttonInsetY
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2173
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2174
3975
ca
parents: 3966
diff changeset
  2175
delayInSecondsBeforeOpeningSubmenu
ca
parents: 3966
diff changeset
  2176
    "answer the seconds a submenu will be delayed before
ca
parents: 3966
diff changeset
  2177
    open; an already open submenu than will be closed"
ca
parents: 3966
diff changeset
  2178
ca
parents: 3966
diff changeset
  2179
    ^ styleSheet at:#'menu.delayInSecondsBeforeOpeningSubmenu'  default:0.2
ca
parents: 3966
diff changeset
  2180
!
ca
parents: 3966
diff changeset
  2181
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2182
drawMenuIndicatorSeparatorLine
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2183
^ true.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2184
    ^ styleSheet at:#'menu.drawMenuIndicatorSeparatorLine'  default:false
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2185
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2186
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2187
enteredLevel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2188
    "returns the enter-level for an unselected item moved through"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2189
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2190
    ^ styleSheet at:#'menu.enteredLevel'  default:0
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2191
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2192
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2193
groupDividerSize
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2194
    "returns the width of a group divider"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2195
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2196
    ^ styleSheet at:#'menu.groupDividerSize' default:6
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2197
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2198
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2199
itemMargin
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2200
    "returns the margin of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2201
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2202
    ^ styleSheet at:#'menu.itemMargin' default:0
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2203
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2204
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2205
itemSpace
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2206
    "returns the additional space for an item in a (vertical) panel"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2207
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  2208
    ^ itemSpace
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2209
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2210
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2211
menuIndicatorVerticalPosition
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2212
    "#center, #top or #bottom"
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2213
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2214
    ^ #center
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2215
    "/ ^ styleSheet at:#'menu.menuIndicatorVerticalPosition' default:#bottom
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2216
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2217
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2218
selectionFollowsMouse
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2219
    "returns true if the selection follows the mouse"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2220
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2221
    ^ styleSheet at:#'menu.selectionFollowsMouse' default:false
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2222
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2223
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2224
shortcutKeyOffset
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2225
    "returns the offset for a shortcutKey"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2226
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2227
    ^ 5
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2228
! !
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2229
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  2230
!MenuPanel methodsFor:'accessing-submenu'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2231
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2232
subMenuAt:stringOrNumber
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2233
    "gets the current submenu of an item; if the submenu is nil, the
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2234
     submenu is generated if specified otherwise nil is returned."
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2235
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2236
    |submenu|
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2237
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2238
    self itemAt:stringOrNumber do:[:anItem|
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2239
	submenu := anItem currentSubmenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2240
	submenu isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2241
	    submenu := anItem setupSubmenu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2242
	].
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2243
    ].
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2244
    ^ submenu
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  2245
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  2246
    "Modified: / 22-09-2010 / 13:53:21 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2247
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2248
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2249
subMenuAt:stringOrNumber put:aSubMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2250
    "sets the submenu of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2251
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2252
    self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2253
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2254
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2255
subMenuShown
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2256
    "return the currently visible submenu - or nil if there is none"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2257
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2258
    |item submenu|
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2259
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2260
    item := self selection.
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2261
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2262
    item notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2263
	submenu := item currentSubmenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2264
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2265
	(submenu notNil and:[submenu shown]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2266
	    ^ submenu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2267
	].
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2268
    ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2269
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2270
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2271
2504
0ce78a73aacf method category rename
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
  2272
!MenuPanel methodsFor:'activation & deactivation'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2273
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  2274
closeMenus
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2275
    "close all menus without accepting"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2276
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  2277
    self topMenu accept:nil.
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  2278
!
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  2279
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2280
hide
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2281
    "hide the view, leave its modal event loop"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2282
2407
d8cdc13f677b checkin from browser
penk
parents: 2374
diff changeset
  2283
    "/ TODO: replace with LeaveSignal raise.
d8cdc13f677b checkin from browser
penk
parents: 2374
diff changeset
  2284
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2285
    self selection:nil.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2286
    self unmap.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2287
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2288
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2289
show
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2290
    "realize the view at its last position;
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2291
     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
  2292
     (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
  2293
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2294
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2295
    ^ self showAt:(self origin) resizing:true
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2296
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2297
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2298
showAt:aPoint
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2299
    "realize the view at aPoint.
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2300
     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
  2301
     (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
  2302
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2303
3754
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  2304
    ^ self showAt:aPoint resizing:true
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2305
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2306
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2307
showAt:aPoint resizing:aBoolean
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2308
    "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
  2309
     or if I have already performed.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2310
     Return the items value, otherwise.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2311
     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
  2312
     menu (i.e. the view or controller), which will perform the action
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2313
     if a non-nil is returned."
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2314
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  2315
    self origin:aPoint.
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2316
    self rearrangeItemsIfItemVisibilityChanged.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2317
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2318
    aBoolean ifTrue:[
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2319
        self fixSize.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2320
    ].
1459
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  2321
"/    self makeFullyVisible.   -- done in realize
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2322
    self openModal:[true]. "realize     "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2323
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2324
    "/ if I have already performed,
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2325
    "/ return nil - to avoid items triggering twice.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2326
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2327
    self topMenu hasPerformed ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2328
        ^ nil
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2329
    ].
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2330
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2331
    ^ self lastValueAccepted
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2332
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2333
    "Modified: / 29-06-2011 / 16:24:22 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2334
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2335
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2336
showAtPointer
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2337
    "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
  2338
     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
  2339
     (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
  2340
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2341
4064
b8060862ebe1 comment/format in: #showAtPointer
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  2342
    ^ self showAt:(device pointerPosition) resizing:true
b8060862ebe1 comment/format in: #showAtPointer
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  2343
b8060862ebe1 comment/format in: #showAtPointer
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  2344
    "Modified (format): / 22-07-2011 / 15:24:48 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2345
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2346
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2347
showCenteredIn:aView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2348
    "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
  2349
     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
  2350
     (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
  2351
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2352
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2353
    |top|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2354
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2355
    top := aView topView.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2356
    top raise.
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2357
    ^ 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
  2358
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2359
    "Modified: / 15.9.1998 / 12:45:50 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2360
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2361
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2362
startUp
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2363
    "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
  2364
     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
  2365
     (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
  2366
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2367
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2368
    ^ self showAtPointer
897
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2369
!
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2370
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2371
startUpAt:aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2372
    "realize the menu at aPoint
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2373
     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
  2374
     (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
  2375
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2376
897
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2377
    ^ self showAt:aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2378
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2379
    "Created: / 21.5.1998 / 14:15:57 / cg"
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2380
!
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2381
2332
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2382
startUpFor:originatingWidget
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2383
    "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
  2384
     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
  2385
     (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
  2386
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2387
2332
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2388
    originator := originatingWidget.
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2389
    ^ self startUp
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2390
!
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2391
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2392
startUpOrNil
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2393
    "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
  2394
     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
  2395
     (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
  2396
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2397
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2398
    ^ self showAtPointer
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2399
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2400
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2401
!MenuPanel methodsFor:'adding & removing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2402
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2403
createAtIndex:anIndexOrNil
1800
600f247a2846 comment
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  2404
    "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
  2405
     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
  2406
     otherwise the new created item is returned."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2407
4046
6dc83104243b changed: #createAtIndex:
Claus Gittinger <cg@exept.de>
parents: 4042
diff changeset
  2408
    |max item index|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2409
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2410
    max := (items size) + 1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2411
4046
6dc83104243b changed: #createAtIndex:
Claus Gittinger <cg@exept.de>
parents: 4042
diff changeset
  2412
    (index := anIndexOrNil) notNil ifTrue:[
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2413
        (anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[
4046
6dc83104243b changed: #createAtIndex:
Claus Gittinger <cg@exept.de>
parents: 4042
diff changeset
  2414
            index := max.
6dc83104243b changed: #createAtIndex:
Claus Gittinger <cg@exept.de>
parents: 4042
diff changeset
  2415
            "/ ^ nil
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2416
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2417
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2418
    items isNil ifTrue:[
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2419
        items := OrderedCollection new
1151
199863d6a463 items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents: 1137
diff changeset
  2420
    ] ifFalse:[
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2421
        items := items asOrderedCollection
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2422
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2423
    item := Item in:self.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2424
4046
6dc83104243b changed: #createAtIndex:
Claus Gittinger <cg@exept.de>
parents: 4042
diff changeset
  2425
    (index isNil or:[index == max]) ifTrue:[
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2426
        items add:item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2427
    ] ifFalse:[
4046
6dc83104243b changed: #createAtIndex:
Claus Gittinger <cg@exept.de>
parents: 4042
diff changeset
  2428
        items add:item beforeIndex:index
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2429
    ].
3966
0badf955fd73 changed:
Claus Gittinger <cg@exept.de>
parents: 3965
diff changeset
  2430
    self mustRearrange.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2431
    ^ item
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2432
4046
6dc83104243b changed: #createAtIndex:
Claus Gittinger <cg@exept.de>
parents: 4042
diff changeset
  2433
    "Modified: / 03-07-2011 / 22:49:47 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2434
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2435
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2436
remove:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2437
    "remove the first item which is assigned to stringOrNumber;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2438
     if found, remove and return it"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2439
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2440
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2441
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2442
    (item := self itemAt:stringOrNumber) notNil ifTrue:[
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2443
        items remove:item.
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2444
        items isEmpty ifTrue:[items := nil].
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2445
        item destroy.
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2446
        self mustRearrange.
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2447
    ].
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2448
    ^ item
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2449
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2450
    "Modified: / 09-11-2010 / 10:04:08 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2451
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2452
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2453
removeAll
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2454
    "remove all items and submenus"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2455
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2456
    self disabledRedrawDo:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2457
	self selection:nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2458
	groupSizes := nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2459
	items notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2460
	    items copy do:[:el| el destroy ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2461
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2462
	items := nil
2050
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
  2463
    ].
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
  2464
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
  2465
    "Modified: / 15.11.2001 / 17:02:51 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2466
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2467
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2468
!MenuPanel methodsFor:'change & update'!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2469
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2470
update:something with:aParameter from:changedObject
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2471
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2472
    changedObject == menuHolder    ifTrue:[^ self menu:(menuHolder value)].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2473
    changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2474
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2475
    super update:something with:aParameter from:changedObject
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2476
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2477
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2478
!MenuPanel methodsFor:'converting'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2479
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2480
asMenu
3222
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2481
    "convert contents to a menu"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2482
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2483
    |menu|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2484
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2485
    menu := Menu new.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2486
    menu groupSizes:groupSizes.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2487
    self do:[:anItem| menu addItem:(anItem asMenuItem) ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  2488
    ^ menu
3222
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2489
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2490
    "Modified: / 27-03-2007 / 08:39:48 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2491
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2492
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2493
fromSpec:aMenuSpec
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2494
    "build from spec"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2495
3222
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2496
    self menu:(Menu decodeFromLiteralArray:aMenuSpec)
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2497
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2498
    "Modified: / 27-03-2007 / 08:42:43 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2499
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2500
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2501
menu:aMenu
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2502
    "setup from a menu"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2503
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2504
    self disabledRedrawDo:[
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2505
        |menu newItems menuReceiver|
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2506
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2507
        self removeAll.
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2508
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2509
        (menu := aMenu) notNil ifTrue:[
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2510
            (aMenu isCollection) ifTrue:[
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2511
                menu := Menu decodeFromLiteralArray:aMenu.
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2512
            ] ifFalse:[
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2513
                menuReceiver := menu receiver.
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2514
                menuReceiver notNil ifTrue:[
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2515
                    self receiver:menuReceiver.
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2516
                ]
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2517
            ].
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2518
            (newItems := menu menuItems) notEmptyOrNil ifTrue:[
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2519
                items := newItems collect:[:ni |
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2520
                                |i|
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2521
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2522
                                i:= Item in:self.
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2523
                                i menuItem:ni.
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2524
                                i.
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2525
                            ].
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2526
            ].
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2527
            self groupSizes:(menu groupSizes).
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2528
        ]
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2529
    ]
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2530
3966
0badf955fd73 changed:
Claus Gittinger <cg@exept.de>
parents: 3965
diff changeset
  2531
    "Modified: / 09-11-2010 / 11:52:28 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2532
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2533
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2534
!MenuPanel methodsFor:'dependents access'!
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2535
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2536
addDependencies
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2537
    "add all dependencies"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2538
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2539
    self do:[:anItem| anItem addDependencies ].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2540
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2541
    menuHolder    notNil ifTrue:[menuHolder    addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2542
    enableChannel notNil ifTrue:[enableChannel addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2543
!
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2544
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2545
removeDependencies
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2546
    "remove all dependencies"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2547
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2548
    self do:[:anItem| anItem removeDependencies ].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2549
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2550
    menuHolder    notNil ifTrue:[menuHolder    removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2551
    enableChannel notNil ifTrue:[enableChannel removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2552
! !
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2553
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2554
!MenuPanel methodsFor:'drawing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2555
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2556
disabledRedrawDo:aBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2557
    "evaluate a block without redrawing within the block; after processing
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2558
     of the block a redraw might be performed"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2559
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2560
    |state|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2561
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2562
    state := mustRearrange.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2563
    mustRearrange := true.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2564
    aBlock value.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2565
    mustRearrange := state.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2566
    self mustRearrange
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2567
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2568
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2569
drawButtonEdgesFor:anItem level:aLevel
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2570
    |layout|
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2571
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2572
    aLevel ~~ 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2573
	layout := anItem layout.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2574
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2575
	styleSheet is3D ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2576
	    self displayRectangle:layout.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2577
	] ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2578
	    self drawEdgesForX:(layout left)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2579
			     y:(layout top)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2580
			 width:(layout width)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2581
			height:(layout height)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2582
			 level:aLevel
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2583
			shadow:(self buttonShadowColor)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2584
			 light:(self buttonLightColor)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2585
		    halfShadow:(self buttonHalfShadowColor)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2586
		     halfLight:(self buttonHalfLightColor)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2587
			 style:(self buttonEdgeStyle)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2588
	]
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2589
    ]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2590
!
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2591
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2592
drawFocusForItem:anItem
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2593
    |lytItem|
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2594
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2595
    lytItem := anItem layout.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2596
    self paint:(Color black).
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2597
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2598
    self displayDottedRectangleX:(lytItem left)
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2599
			       y:(lytItem top)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2600
			   width:(lytItem width)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2601
			  height:(lytItem height).
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2602
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2603
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2604
drawItemsX:x y:y width:w height:h
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2605
    "redraw items and groups in a damage"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2606
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2607
    |isVertical item layout prevClip
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2608
     x1             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2609
     x2             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2610
     y1             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2611
     y2             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2612
     start          "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2613
     stop           "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2614
     size           "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2615
     groupDivInset  "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2616
    |
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2617
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2618
    size := items size.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2619
    isVertical := self verticalLayout.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2620
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2621
    isVertical ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2622
	start := items findFirst:[:el| |l| l := el layout. l notNil and:[l bottom > y]].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2623
	start == 0 ifTrue:[ ^ self ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2624
	y1 := y + h.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2625
	stop := items findFirst:[:el| |l| l := el layout. l notNil and:[l top > y1] ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2626
		     startingAt:(start + 1).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2627
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2628
	start := items findFirst:[:el| |l| l := el layout. l notNil and:[l right > x ]].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2629
	start == 0 ifTrue:[ ^ self ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2630
	x1  := x + w.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2631
	stop := items findFirst:[:el| |l| l := el layout.l notNil and:[l left > x1]]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2632
		     startingAt:(start + 1).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2633
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2634
    stop  == 0 ifTrue:[stop := size] ifFalse:[stop := stop - 1].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2635
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2636
    (groupSizes size ~~ 0 and:[showGroupDivider]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2637
	groupDivInset := self groupDividerSize // 2.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2638
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2639
	groupDivInset ~~ 0 ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2640
	    (start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2641
		start := start - 1
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2642
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2643
	].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2644
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2645
	groupDivInset := 0
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2646
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2647
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2648
    prevClip := clipRect.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2649
    self clippingRectangle:(Rectangle left:x top:y width:w height:h).
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2650
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2651
    start to:stop do:[:i|
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2652
	item := items at:i.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2653
	item draw.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2654
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2655
	(groupDivInset ~~ 0 and:[i ~~ size and:[self hasGroupDividerAt:i]]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2656
	    layout := item layout.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2657
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2658
	    isVertical ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2659
		x1 := layout left.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2660
		x2 := layout right.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2661
		y1 := layout bottom + groupDivInset.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2662
		y2 := y1.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2663
	    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2664
		y1 := layout top.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2665
		y2 := layout bottom.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2666
		x1 := layout right + groupDivInset.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2667
		x2 := x1.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2668
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2669
	    self paint:shadowColor.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2670
	    self displayLineFromX:x1 y:y1 toX:x2 y:y2.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2671
	    self paint:lightColor.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2672
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2673
	    isVertical ifTrue:[y1 := y1 + 1. y2 := y1 ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2674
		      ifFalse:[x1 := x1 + 1. x2 := x1 ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2675
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2676
	    self displayLineFromX:x1 y:y1 toX:x2 y:y2
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2677
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2678
	selection == item ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2679
	    self focusComesByTab ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2680
		self drawFocusForItem:item.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2681
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2682
	].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2683
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2684
    self clippingRectangle:prevClip.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2685
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2686
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2687
drawLabelEdgeFor:anItem selected:isSelected
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2688
    |level layout|
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2689
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2690
    isSelected ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2691
	level := styleSheet at:#'menu.hilightLevel' default:0.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2692
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2693
	anItem == enteredItem ifTrue:[ level := self enteredLevel ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2694
			     ifFalse:[ level := 0 ]
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2695
    ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2696
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2697
    level ~~ 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2698
	layout := anItem layout.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2699
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2700
	self drawEdgesForX:(layout left)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2701
			 y:(layout top)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2702
		     width:(layout width)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2703
		    height:(layout height)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2704
		     level:level
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2705
    ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2706
!
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2707
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2708
drawScrollerAt:aDirection bounds:bounds
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2709
    "draw a scroller"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2710
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2711
    |scrolling icon level x y w h|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2712
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2713
    x := bounds left.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2714
    y := bounds top.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2715
    w := bounds width.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2716
    h := bounds height.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2717
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  2718
    scrolling := self scrollActivity.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2719
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2720
    (scrolling activeMenu == self and:[scrolling direction == aDirection]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2721
	level := -2
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2722
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2723
	level := 1
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2724
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2725
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2726
    level ~~ 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2727
	self drawEdgesForX:x y:y width:w height:h level:level.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2728
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2729
    icon := scrolling iconAt:aDirection on:self.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2730
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2731
    icon displayOn:self x:(x + (w - icon width  // 2))
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2732
			y:(y + (h - icon height // 2)).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2733
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2734
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2735
invalidateItem:anItem repairNow:aBool
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2736
    "an item changed; invalidate the items layout"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2737
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2738
    |layout|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2739
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2740
    (mustRearrange not and:[shown]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2741
	layout := anItem layout.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2742
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2743
	(layout bottom > margin and:[layout top < (height - margin)]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2744
	    self invalidate:(layout "insetBy:-1") repairNow:aBool
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2745
	]
1728
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2746
    ].
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2747
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2748
    "Modified: / 29.2.2000 / 11:28:59 / cg"
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  2749
!
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  2750
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2751
mustRearrange
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2752
    "force rearrange (i.e. set the rearrange flag)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2753
2080
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2754
    mustRearrange ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2755
	mustRearrange := true.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2756
	self invalidate "/ RepairNow:true
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2757
    ]
590
3177528b5f95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  2758
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  2759
    "Modified: / 6.6.1998 / 19:51:07 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2760
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2761
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2762
rearrangeGroups
3126
8dca3b01f1db new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3125
diff changeset
  2763
    "implements the groupIdentifier #right/#conditionalRight in a horizontal menu"
8dca3b01f1db new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3125
diff changeset
  2764
8dca3b01f1db new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3125
diff changeset
  2765
    <resource: #style (#'menuPanel.ignoreConditionalStartGroupRight')>
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2766
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2767
    |layout point
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2768
     dltX  "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2769
     start "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2770
    |
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2771
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2772
    (self isPopUpView or:[self verticalLayout]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2773
	^ self
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2774
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2775
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2776
    layout := items last layout.
3246
c9e0e6fe80a4 changed #rearrangeGroups
Claus Gittinger <cg@exept.de>
parents: 3242
diff changeset
  2777
    layout notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2778
	(dltX := width - margin - layout right) <= 0 ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2779
	    ^ self  "/ no free space
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2780
	].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2781
    ].
3125
25a0bdbe879a startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents: 3122
diff changeset
  2782
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  2783
    "/ The behavior of #conditionalRight is controlled by the styleSheet.
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  2784
    "/ If menuPanel.ignoreConditionalStartGroupRight is true, it is ignored.
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  2785
    "/ otherwise, it is treated like #right.
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  2786
    "/ 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
  2787
    "/ non-right under win32 (as is used woth the help-menus).
3148
6b74db598eae conditionalRight revisited
Claus Gittinger <cg@exept.de>
parents: 3147
diff changeset
  2788
    (StyleSheet at:#'menuPanel.ignoreConditionalStartGroupRight' ifAbsent:false) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2789
	start := items findFirst:[:anItem| anItem startGroup == #right ].
3148
6b74db598eae conditionalRight revisited
Claus Gittinger <cg@exept.de>
parents: 3147
diff changeset
  2790
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2791
	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
  2792
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2793
    start == 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2794
	^ self  "/ no right-group item detected
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2795
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2796
    point := dltX @ 0.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2797
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2798
    "/ move items layout to right
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2799
    items from:start do:[:anItem|
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2800
	anItem isVisible ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2801
	    anItem layout moveBy:point.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2802
	]
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2803
    ].
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2804
    self updateEnteredItem.
3125
25a0bdbe879a startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents: 3122
diff changeset
  2805
3246
c9e0e6fe80a4 changed #rearrangeGroups
Claus Gittinger <cg@exept.de>
parents: 3242
diff changeset
  2806
    "Modified: / 10-10-2007 / 00:29:34 / cg"
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2807
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2808
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2809
rearrangeItems
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2810
    "recompute the layout of each item
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2811
	!!!!!! changes have influence on method #preferredExtentOfItems !!!!!!"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2812
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2813
    |isVertical extent isPopUpMenu
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2814
     x            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2815
     y            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2816
     x0           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2817
     y0           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2818
     x1           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2819
     y1           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2820
     size         "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2821
     insetX       "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2822
     insetY       "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2823
     labelInsetX  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2824
     labelInsetY  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2825
     itemMargin   "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2826
     groupDividerSize "{ Class:SmallInteger }"
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2827
    |
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2828
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2829
    (mustRearrange and:[(size := items size) ~~ 0]) ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2830
	mustRearrange := false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2831
	^ self
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2832
    ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2833
2080
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2834
"/  DON'T SET THIS!!
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2835
"/  item layout:  below of first item -> item invalidate
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2836
"/                                    -> menuPanel invalidateItem:repairDamage:
2080
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2837
"/                                    -> invalidate:rapairDamage:
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2838
"/                                    -> redrawX:y:width:height:
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2839
"/                                    tries to get uninitialized layout from second item.
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2840
"/ This happens in a modal debugger!!
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2841
"/    mustRearrange := false.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2842
    isVertical       := self verticalLayout.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2843
    groupDividerSize := self groupDividerSize.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2844
    isPopUpMenu      := self isPopUpView.
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2845
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2846
    isPopUpMenu ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2847
	labelInsetX := labelInsetY := self enteredLevel abs.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2848
    ] ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2849
	labelInsetX := labelInsetY := 0
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2850
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2851
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2852
    (isPopUpMenu or:[self hasExplicitExtent not]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2853
	|saveExtent maxExtent extentToSet|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2854
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2855
	extent := self preferredExtent.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2856
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2857
	isPopUpMenu ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2858
	    maxExtent := self maxExtent.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2859
	    maxExtent notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2860
		extentToSet := isVertical ifTrue:[extent x @ (extent y min:(maxExtent y))]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2861
					  ifFalse:[(extent x min:(maxExtent x)) @ extent y].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2862
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2863
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2864
	    extent := extentToSet := isVertical ifTrue:[extent x @ 1.0] ifFalse:[1.0 @ extent y].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2865
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2866
	self extent:extentToSet.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2867
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2868
	extent := self computeExtent
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2869
    ].
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2870
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  2871
    x := y := margin.
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  2872
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2873
    isVertical ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2874
	y0 := margin.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2875
	y1 := extent y - margin.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2876
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2877
	items keysAndValuesDo:[:anIndex :el|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2878
	    el isVisible ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2879
		el layout:(Rectangle left:x top:y0 right:x bottom:y1)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2880
	    ] ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2881
		el isButton ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2882
		    insetX := buttonInsetX.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2883
		    insetY := buttonInsetY.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2884
		] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2885
		    insetX := labelInsetX.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2886
		    insetY := labelInsetY.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2887
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2888
		x0 := x  + insetX.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2889
		x1 := x0 + (el preferredWidth).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2890
		el layout:(Rectangle left:x0 top:(y0 + insetY) right:x1 bottom:(y1 - insetY)).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2891
		x := x1 + insetX.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2892
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2893
		size ~~ anIndex ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2894
		    (self hasGroupDividerAt:anIndex) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2895
			x := x + groupDividerSize
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2896
		    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2897
			el needsItemSpaceWhenDrawing ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2898
			    x := x + itemSpace
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2899
			]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2900
		    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2901
		]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2902
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2903
	].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2904
    ] ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2905
	itemMargin := self itemMargin.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2906
	x0 := margin.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2907
	x1 := extent x - margin - itemMargin.  "/ -1
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2908
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2909
	items keysAndValuesDo:[:anIndex :el|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2910
	    el isVisible ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2911
		el layout:(Rectangle left:x0 top:y right:x1 bottom:y)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2912
	    ] ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2913
		el isButton ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2914
		    insetX := buttonInsetX.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2915
		    insetY := buttonInsetY.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2916
		] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2917
		    insetX := labelInsetX.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2918
		    insetY := labelInsetY.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2919
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2920
		y0 := y  + insetY.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2921
		y1 := y0 + el preferredHeight.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2922
		el layout:(Rectangle left:(x0 + insetX + itemMargin) top:y0 right:(x1 - insetX) bottom:y1).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2923
		y := y1 + insetY.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2924
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2925
		size ~~ anIndex ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2926
		    (self hasGroupDividerAt:anIndex) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2927
			y := y + groupDividerSize
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2928
		    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2929
		]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2930
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2931
	]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2932
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2933
    self rearrangeGroups.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  2934
    selection notNil ifTrue:[self makeItemVisible:selection].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2935
    mustRearrange := false.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  2936
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  2937
    "Modified: / 13.11.2001 / 20:17:21 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2938
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2939
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2940
rearrangeItemsIfItemVisibilityChanged
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2941
    "check for items which can change its visibility;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2942
     if at least one item exists, rearrange all items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2943
1464
3070de4c8b88 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
  2944
    items isNil ifTrue:[^ self].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2945
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2946
    items do:[:item |
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2947
	item canChangeVisibility ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2948
	    mustRearrange := true.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2949
	    self rearrangeItems.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2950
	    ^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2951
	].
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2952
    ]
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2953
!
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2954
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2955
redrawX:x y:y width:w height:h
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2956
    "redraw a damage"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2957
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2958
    |y0 y1 x0 x1 prvBound mustDraw nxtBound|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2959
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2960
    (shown and:[w ~~ 0]) ifFalse:[^ self].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2961
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2962
    mustRearrange ifTrue:[
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2963
        self isPopUpView ifFalse:[ self explicitExtent:true].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2964
        self rearrangeItems.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2965
        self invalidate.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2966
        ^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2967
    ].
2888
095d9fb3e846 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2884
diff changeset
  2968
    "/ self paint:(self viewBackground).
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2969
    self clearRectangleX:x y:y width:w height:h.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2970
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2971
    items size == 0 ifTrue:[
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2972
        ^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2973
    ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2974
    y0 := y.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2975
    y1 := y + h.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2976
    x0 := x.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2977
    x1 := x + w.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2978
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2979
    "Draw the scroll handles - especially for Popup-Lists"
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2980
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  2981
    self hasScrollers ifTrue:[
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2982
        (self hasScrollerAt:#PREV) ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2983
            prvBound := self scrollerBoundsAt:#PREV.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2984
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2985
            self verticalLayout ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2986
                (mustDraw := (prvBound bottom > y)) ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2987
                    y0 := prvBound bottom.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2988
                ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2989
            ] ifFalse:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2990
                (mustDraw := (prvBound right > x)) ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2991
                    x0 := prvBound right.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2992
                ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2993
            ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2994
            mustDraw ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2995
                self drawScrollerAt:#PREV bounds:prvBound.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2996
            ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2997
        ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2998
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2999
        (self hasScrollerAt:#NEXT) ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3000
            nxtBound := self scrollerBoundsAt:#NEXT.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3001
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3002
            self verticalLayout ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3003
                (mustDraw := (nxtBound top < y1)) ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3004
                    y1 := nxtBound top.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3005
                ]
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3006
            ] ifFalse:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3007
                (mustDraw := (nxtBound left < x1)) ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3008
                    x1 := nxtBound left.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3009
                ]
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3010
            ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3011
            mustDraw ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3012
                self drawScrollerAt:#NEXT bounds:nxtBound.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3013
            ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3014
        ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3015
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3016
    lastDrawnScrollerNextBounds := nxtBound.
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3017
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  3018
    (y1 > y0 and:[x1 > x0]) ifTrue:[
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3019
        self drawItemsX:x0 y:y0 width:(x1 - x0) height:(y1 - y0)
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3020
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3021
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3022
    "Modified: / 29-06-2011 / 16:24:34 / cg"
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3023
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3024
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3025
updateEnteredItem
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3026
    |mousePoint|
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3027
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3028
    mousePoint  := device translatePoint:(device pointerPosition)
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3029
			   fromView:nil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3030
			     toView:self.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3031
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3032
    (self containsPoint:mousePoint) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3033
	enteredItem := self itemAtPoint:mousePoint
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3034
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3035
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3036
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3037
!MenuPanel methodsFor:'enumerting & searching'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3038
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3039
collect:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3040
    "evaluate the argument, aOneArgBlock for every item in the menuPanel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3041
     and return a collection of the results"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3042
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3043
    items notNil ifTrue:[^ items collect:aOneArgBlock ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  3044
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3045
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3046
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3047
do:aOneArgBlock
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3048
    "evaluate the argument, aOneArgBlock for every item in the menuPanel."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3049
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3050
    items notNil ifTrue:[ items do:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3051
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3052
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3053
findFirst:aOneArgBlock
3206
48a66f672af3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3203
diff changeset
  3054
    "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
  3055
     returns true; return its index or 0 if none detected."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3056
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3057
    items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ].
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3058
    ^ 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3059
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3060
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3061
findLast:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3062
    "find the last item, for which evaluation of the argument, aOneArgBlock
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3063
     returns true; return its index or 0 if none detected."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3064
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3065
    items notNil ifTrue:[ ^ items findLast:aOneArgBlock ].
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3066
    ^ 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3067
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3068
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3069
firstItemSelectable
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3070
    "returns the first item which is selectable or nil
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3071
    "
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3072
    items size > 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3073
	^ items detect:[:anItem| anItem canSelect ] ifNone:nil
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3074
    ].
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3075
    ^ nil
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3076
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3077
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3078
indexOf:something
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3079
    "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
  3080
     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
  3081
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3082
    |i v|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3083
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3084
    something isNumber ifTrue:[ ^ something ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3085
    something isNil    ifTrue:[ ^ 0 ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3086
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3087
    i := self findFirst:[:el | (el nameKey = something) or: [el = something]].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3088
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3089
    i ~~ 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3090
	^ i
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3091
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3092
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3093
    something isSymbol ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3094
	i := self findFirst:[:el|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3095
				v := el value.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3096
				v isSymbol and:[v == something]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3097
			    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3098
	i ~~ 0 ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3099
	    ^ i
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3100
	]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3101
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3102
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3103
    (something respondsTo:#string) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3104
	v := something string.
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3105
      ^ self findFirst:[:el | el textLabel = v].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3106
    ].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3107
    ^ 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3108
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3109
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  3110
indexOfItem:anItem
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3111
    "returns the index of the item or 0"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3112
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  3113
    ^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0]
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  3114
!
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  3115
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3116
keysAndValuesDo:aTwoArgBlock
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3117
    "evaluate the argument, aTwoArgBlock for every item in the menuPanel."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3118
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3119
    items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3120
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3121
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3122
!MenuPanel methodsFor:'event handling'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3123
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3124
buttonMotion:state x:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3125
    "open or close the corresponding submenu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3126
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3127
    |menue motionPoint translatedPoint sensor|
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3128
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3129
    self scrollActivity isActive ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3130
	^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3131
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3132
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3133
    sensor := self sensor.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3134
    (sensor isNil or:[sensor hasButtonMotionEventFor:nil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3135
	^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3136
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3137
    menue := self detectGrabMenu.
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3138
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3139
    motionPoint := x@y.
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3140
    translatedPoint := menue translateGrabPoint:motionPoint.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3141
    menue handleButtonMotion:state atPoint:translatedPoint.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3142
3780
14184c505e24 changed:
Claus Gittinger <cg@exept.de>
parents: 3754
diff changeset
  3143
    "/ hideOnRelease := true.
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3144
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3145
    (self isPopUpView or:[sensor anyButtonPressed]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3146
	^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3147
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3148
3826
608aa28e7676 changed: #buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 3823
diff changeset
  3149
    hideOnRelease ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3150
	sensor anyButtonPressed ifFalse:[^ self]
3826
608aa28e7676 changed: #buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 3823
diff changeset
  3151
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3152
	sensor anyButtonPressed ifTrue:[^ self]
3826
608aa28e7676 changed: #buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 3823
diff changeset
  3153
    ].
608aa28e7676 changed: #buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 3823
diff changeset
  3154
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3155
    (selection notNil and:[selection visibleSubmenu isNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3156
	"/ selection on grabView without a submenu (Button ...); check whether moving out
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3157
	(self containsPoint:motionPoint) ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3158
	    ^ self accept:nil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3159
	]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3160
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3161
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3162
    "Modified: / 13.11.2001 / 20:21:49 / cg"
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3163
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3164
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3165
buttonPress:button x:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3166
    "any button pressed; open or close the corresponding submenus"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3167
3921
09b1cdfaba70 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3168
    |menu point screen screenPoint targetView targetPoint|
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3169
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3170
    hideOnRelease := true.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3171
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3172
    self scrollActivity stop.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3173
    point := x@y.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3174
    menu  := self detectMenuAtGrabPoint:point.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3175
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3176
    menu isNil ifTrue:[
4082
e85a434b71ed changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
  3177
        self accept:nil.
e85a434b71ed changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
  3178
e85a434b71ed changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
  3179
        "/ tell underlying view about the click...
e85a434b71ed changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
  3180
        (button == 2 and:[UserPreferences current showRightButtonMenuOnRelease]) ifTrue:[
e85a434b71ed changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
  3181
            screen := self device.
e85a434b71ed changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
  3182
            screenPoint := screen translatePointToRoot:point fromView:self.
e85a434b71ed changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
  3183
            targetView := screen viewFromPoint:screenPoint.
e85a434b71ed changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
  3184
            targetView notNil ifTrue:[
e85a434b71ed changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
  3185
                targetPoint := screen translatePoint:screenPoint fromView:screen rootView toView:targetView.
e85a434b71ed changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
  3186
                targetView buttonPress:button x:targetPoint x y:targetPoint y.
e85a434b71ed changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
  3187
            ]
e85a434b71ed changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
  3188
        ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3189
    ] ifFalse:[
4082
e85a434b71ed changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
  3190
        point := menu translateGrabPoint:point.
e85a434b71ed changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
  3191
        menu handleButtonPress:button atPoint:point.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3192
    ]
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3193
4082
e85a434b71ed changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
  3194
    "Modified: / 02-10-2011 / 09:20:08 / cg"
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3195
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3196
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3197
buttonRelease:button x:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3198
    "button release action; accept selection and close all views"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3199
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3200
    |topMenu dstMenu item srcPoint dstPoint subm hideMenuAndPerformAction
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  3201
     releaseTime menuMapTime|
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  3202
3780
14184c505e24 changed:
Claus Gittinger <cg@exept.de>
parents: 3754
diff changeset
  3203
    hideOnRelease ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3204
	^ self
3780
14184c505e24 changed:
Claus Gittinger <cg@exept.de>
parents: 3754
diff changeset
  3205
    ].
14184c505e24 changed:
Claus Gittinger <cg@exept.de>
parents: 3754
diff changeset
  3206
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  3207
    topMenu := self topMenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  3208
    topMenu openDelayed:nil.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3209
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3210
    self scrollActivity stop ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3211
	^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3212
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3213
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3214
    dstMenu := topMenu activeMenu.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3215
2679
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  3216
    hideMenuAndPerformAction := dstMenu selection notNil or:[dstMenu isPopUpView not].
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  3217
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  3218
    hideMenuAndPerformAction ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3219
	hideOnRelease ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3220
	    releaseTime := windowGroup lastEvent timeStamp.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3221
	    menuMapTime := dstMenu mapTime ? releaseTime.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3222
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3223
	    hideMenuAndPerformAction := (releaseTime millisecondDeltaFrom:menuMapTime)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3224
					> (PopUpMenu maxClickTimeToStayOpen).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3225
	].
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3226
    ].
2679
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  3227
    hideMenuAndPerformAction ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3228
	srcPoint := x@y.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3229
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3230
	(     (dstMenu := self detectMenuAtGrabPoint:srcPoint) notNil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3231
	 and:[(item    := dstMenu selection) notNil]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3232
	) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3233
	    item visibleSubmenu notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3234
		dstMenu selection:nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3235
		(selection isNil and:[self isPopUpView not]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3236
		    self accept:nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3237
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3238
		^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3239
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3240
	    subm := item currentSubmenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3241
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3242
	    subm notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3243
		subm shown ifTrue:[^ self].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3244
		"/ test whether any action is assigned to the menu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3245
		"/ if not ignorre accept
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3246
		item hasDelayedMenu ifFalse:[^ self].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3247
		"/ handle action defined for the delayed menu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3248
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3249
	    dstPoint := dstMenu translateGrabPoint:srcPoint.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3250
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3251
	    (dstMenu itemAtPoint:dstPoint) == dstMenu selection ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3252
		item := nil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3253
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3254
	    topMenu acceptItem:item inMenu:dstMenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3255
	    ^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3256
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3257
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3258
	(selection notNil and:[dstMenu == self]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3259
	    selection visibleSubmenu notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3260
		^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3261
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3262
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3263
	self accept:nil.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3264
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3265
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3266
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3267
handleSizeChanged:how
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3268
    "used to handle the scrollers and groups in a none popUpView
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3269
    "
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3270
    |layouts damage isVertical scrollBound|
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3271
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3272
    (mustRearrange or:[items size == 0 or:[self isPopUpView]]) ifTrue:[
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3273
        ^ self
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3274
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3275
    mustRearrange := true.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3276
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3277
    shown ifFalse:[
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3278
        ^ self
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3279
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3280
    layouts := OrderedCollection new.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3281
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3282
    items do:[:el| |layout|
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3283
        (layout := el layout) isNil ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3284
            self invalidate.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3285
            ^ self.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3286
        ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3287
        layouts add:layout.
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3288
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3289
    isVertical  := self verticalLayout.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3290
    scrollBound := self scrollerBoundsAt:#NEXT.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3291
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3292
    self rearrangeItems.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3293
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3294
    items keysAndValuesDo:[:i :el| |newLyt oldLyt|
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3295
        damage isNil ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3296
            newLyt := el layout.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3297
            oldLyt := layouts at:i ifAbsent:newLyt.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3298
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3299
            newLyt ~= oldLyt ifTrue:[ |x y start|
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3300
                start := 0.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3301
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3302
                i > 1 ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3303
                    isVertical ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3304
                        x := 0.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3305
                        y := start := (oldLyt top min:(newLyt top)) min:(height - scrollBound height).
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3306
                    ] ifFalse:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3307
                        y := 0.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3308
                        x := start := (oldLyt left min:(newLyt left)) min:(width - scrollBound width).
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3309
                    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3310
                ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3311
                start <= 20 ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3312
                    self invalidate.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3313
                    ^ self
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3314
                ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3315
                damage := Rectangle left:x top:y extent:(self extent).
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3316
            ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3317
        ].
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3318
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3319
    damage isNil ifTrue:[
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3320
        damage := scrollBound.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3321
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3322
    scrollBound := lastDrawnScrollerNextBounds.
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3323
    scrollBound notNil ifTrue:[
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3324
        damage := damage merge:scrollBound
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3325
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3326
    self invalidate:damage.
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3327
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3328
    "Modified: / 29-06-2011 / 16:24:59 / cg"
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3329
!
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3330
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3331
keyPress:key x:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3332
    "any key is pressed"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3333
2869
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3334
    <resource: #keyboard (#Escape
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3335
			  #Tab #FocusNext #FocusPrevious
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3336
			  #CursorLeft #CursorRight )>
2869
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3337
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3338
    |menu menusSuperMenu sensor|
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3339
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3340
    sensor := self sensor.
3158
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3341
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3342
"/    sensor anyButtonPressed ifTrue:[
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3343
"/        ^ self  "/ ignored while any button is pressed
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3344
"/    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3345
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3346
    self scrollActivity isActive ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3347
	key ~~ #Escape ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3348
	    ^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3349
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3350
	self scrollActivity stop
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3351
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3352
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3353
       (key == #Tab
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3354
    or:[key == #FocusNext
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3355
    or:[key == #FocusPrevious]]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3356
	self accept:nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3357
	^ super keyPress:key x:x y:y
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3358
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3359
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3360
    menu := self detectGrabMenu.
2869
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3361
    menusSuperMenu := menu superMenu.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3362
3394
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  3363
    (key == #Escape) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3364
	"/ must hide the active menu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3365
	(menusSuperMenu notNil and:[menusSuperMenu ~~ self]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3366
	    "/ hide active menu but keep the grab
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3367
	    menusSuperMenu selection:nil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3368
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3369
	    "/ hide active menu and ungrab
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3370
	    self accept:nil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3371
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3372
	^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3373
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3374
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3375
    menu isViewWrapper ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3376
	sensor compressKeyPressEventsWithKey:key.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3377
	menu handleKeyPress:key.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3378
	^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3379
    ].
2869
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3380
    menusSuperMenu == self ifFalse:[^ self].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3381
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3382
    "/ allow cursor movement
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3383
    (key == #CursorLeft or:[key == #CursorRight]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3384
	(self containsPoint:x@y) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3385
	    self handleKeyPress:key.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3386
	]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3387
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3388
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3389
3834
9ab4091d6829 if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
  3390
mapped
9ab4091d6829 if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
  3391
    super mapped.
9ab4091d6829 if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
  3392
9ab4091d6829 if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
  3393
    "/ if I come up with a pressed button, react on release instead.
9ab4091d6829 if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
  3394
    self device anyButtonPressed ifTrue:[ hideOnRelease := true ].
9ab4091d6829 if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
  3395
!
9ab4091d6829 if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
  3396
3415
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3397
mouseWheelMotion:buttonState x:x y:y amount:amount deltaTime:dTime
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3398
    "mousewheel action"
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3399
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3400
    |menu|
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3401
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3402
    menu := self detectGrabMenu.
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3403
    menu isViewWrapper ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3404
	menu superMenu ~~ self ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3405
	    ^ self.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3406
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3407
	menu := self.
3415
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3408
    ].
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3409
    amount > 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3410
	menu handleCursorKey:#CursorUp.
3415
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3411
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3412
	menu handleCursorKey:#CursorDown.
3415
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3413
    ].
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3414
!
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3415
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3416
pointerLeave:state
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3417
    |sensor|
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3418
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3419
    self scrollActivity isActive ifTrue:[^ self].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3420
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3421
    self detectGrabMenu handlePointerLeave:state.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3422
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3423
    (selection isNil or:[self isPopUpView]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3424
	^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3425
    ].
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3426
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3427
    selection visibleSubmenu notNil ifTrue:[^ self].
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3428
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3429
    windowGroup focusView ~~ self ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3430
	self accept:nil
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3431
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3432
	selection isButton ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3433
	    sensor := self sensor.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3434
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3435
	    sensor isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3436
		self accept:nil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3437
	    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3438
		"/ I'have the focus; if no button pressed, than keep the selection
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3439
		sensor anyButtonPressed ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3440
		    self selection:nil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3441
		]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3442
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3443
	]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3444
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3445
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3446
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3447
sizeChanged:how
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3448
    "redraw #right groups"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3449
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3450
"/    self isPopUpView ifFalse:[
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3451
"/        mustRearrange := true.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3452
"/        self invalidate
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3453
"/    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3454
"/    ^ super sizeChanged:how.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3455
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3456
    self handleSizeChanged:how.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3457
    super sizeChanged:how.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3458
! !
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3459
2503
4f34d55dae21 method category rename
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  3460
!MenuPanel methodsFor:'event handling-processing'!
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3461
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3462
clearImplicitGrab
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3463
    implicitGrabView := lastPointerView := nil.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3464
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3465
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3466
dispatchEvent:ev withFocusOn:focusView delegate:doDelegate
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3467
    "dispatch and handle an event"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3468
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3469
    |view x y p syntheticEvent menu|
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3470
2658
04f9fdd74b8e event handling
Claus Gittinger <cg@exept.de>
parents: 2652
diff changeset
  3471
    ev isDamage ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3472
	^ super dispatchEvent:ev withFocusOn:focusView delegate:false.
2658
04f9fdd74b8e event handling
Claus Gittinger <cg@exept.de>
parents: 2652
diff changeset
  3473
    ].
04f9fdd74b8e event handling
Claus Gittinger <cg@exept.de>
parents: 2652
diff changeset
  3474
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3475
    (superMenu isNil and:[ev isButtonPressEvent]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3476
	focusView ~~ self ifTrue:[prevFocusView := focusView].
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3477
    ].
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3478
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3479
    "/ situation: we get a buttonPress, set implicitGrab (for scrollbars etc.)
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3480
    "/ but never get the buttonRelease, since someone else (a popUp) grabbed the
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3481
    "/ pointer in the meantime, and has eaten the release event ... (double-sigh)
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3482
    implicitGrabView notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3483
	self sensor leftButtonPressed ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3484
	    self clearImplicitGrab.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3485
	].
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3486
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3487
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3488
    ((x := ev x) isNil or:[(y := ev y) isNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3489
	^ super dispatchEvent:ev withFocusOn:focusView delegate:false.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3490
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3491
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3492
    implicitGrabView notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3493
	ev isButtonEvent ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3494
	    p := device translatePoint:(x@y) fromView:self toView:implicitGrabView.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3495
	    ev view:implicitGrabView.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3496
	    ev arguments at:2 put:p x.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3497
	    ev arguments at:3 put:p y.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3498
	    implicitGrabView dispatchEvent:ev withFocusOn:focusView delegate:false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3499
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3500
	    ev isButtonReleaseEvent ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3501
		self clearImplicitGrab.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3502
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3503
	    ^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3504
	]
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3505
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3506
    menu := self detectMenuAtGrabPoint:(x@y).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3507
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3508
    (menu isNil or:[menu isViewWrapper not]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3509
	self clearImplicitGrab.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3510
	^ super dispatchEvent:ev withFocusOn:focusView delegate:false
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3511
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3512
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3513
    p    := menu translateGrabPoint:(x@y).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3514
    view := self detectViewAtX:(p x) y:(p y) in:menu.
3630
1daf110f3011 recursion avoidance
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
  3515
    view == self ifTrue:[^self].  "MB:changed - recursion"
1daf110f3011 recursion avoidance
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
  3516
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3517
    p    := device translatePoint:(x@y) fromView:self toView:view.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3518
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3519
    ev isButtonPressEvent ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3520
	(view wantsFocusWithButtonPress) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3521
	    view requestFocus.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3522
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3523
	view ~~ self ifTrue:[ "/ can this ever be self ?
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3524
	    implicitGrabView := view.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3525
	]
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3526
    ].
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3527
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3528
    ev isButtonMotionEvent ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3529
	lastPointerView ~~ view ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3530
	    "/ must generate enter/leave ... (sigh)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3531
	    lastPointerView notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3532
		"/ XXX: should be fixed
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3533
		syntheticEvent := WindowEvent pointerLeave:0 view:lastPointerView.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3534
		lastPointerView dispatchEvent:syntheticEvent withFocusOn:nil delegate:false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3535
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3536
	    view notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3537
		syntheticEvent := WindowEvent pointerEnter:0 x:x y:y view:view.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3538
		view dispatchEvent:syntheticEvent withFocusOn:nil delegate:false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3539
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3540
	    lastPointerView := view.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3541
	].
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3542
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3543
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3544
    ev view:view.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3545
    ev x:p x.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3546
    ev y:p y.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3547
    view dispatchEvent:ev withFocusOn:focusView delegate:false.
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3548
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3549
    "Modified: / 10.10.2001 / 13:54:47 / cg"
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3550
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3551
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3552
handleButtonMotion:state atPoint:motionPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3553
    "open or close the corresponding submenus"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3554
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3555
    |menu item translatedPoint containsPoint direction|
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3556
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3557
    containsPoint := self containsPoint:motionPoint.
3975
ca
parents: 3966
diff changeset
  3558
ca
parents: 3966
diff changeset
  3559
    (containsPoint not and:[items size > 0]) ifTrue:[
ca
parents: 3966
diff changeset
  3560
        "/ check if there is still open a menu which is not assigned to the
ca
parents: 3966
diff changeset
  3561
        "/ current selection
ca
parents: 3966
diff changeset
  3562
        item := items detect:[:el| el visibleSubmenu notNil ] ifNone:nil.
ca
parents: 3966
diff changeset
  3563
ca
parents: 3966
diff changeset
  3564
        item notNil ifTrue:[
ca
parents: 3966
diff changeset
  3565
            |visibleSubmenu point|
ca
parents: 3966
diff changeset
  3566
ca
parents: 3966
diff changeset
  3567
            visibleSubmenu := item visibleSubmenu.
ca
parents: 3966
diff changeset
  3568
ca
parents: 3966
diff changeset
  3569
            visibleSubmenu notNil ifTrue:[
ca
parents: 3966
diff changeset
  3570
                point := self translateMenuPoint:motionPoint toMenu:visibleSubmenu.
ca
parents: 3966
diff changeset
  3571
ca
parents: 3966
diff changeset
  3572
                (visibleSubmenu containsPoint:point) ifTrue:[
ca
parents: 3966
diff changeset
  3573
                    selection notNil ifTrue:[ selection invalidate ].
ca
parents: 3966
diff changeset
  3574
                    selection := item.
ca
parents: 3966
diff changeset
  3575
                    selection invalidate.
ca
parents: 3966
diff changeset
  3576
                    visibleSubmenu becomesActiveMenu.
ca
parents: 3966
diff changeset
  3577
                    ^ self.
ca
parents: 3966
diff changeset
  3578
                ].
ca
parents: 3966
diff changeset
  3579
            ].
ca
parents: 3966
diff changeset
  3580
            item := nil.
ca
parents: 3966
diff changeset
  3581
        ].
ca
parents: 3966
diff changeset
  3582
    ].
ca
parents: 3966
diff changeset
  3583
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3584
    containsPoint ifTrue:[
3975
ca
parents: 3966
diff changeset
  3585
        item := self itemAtPoint:motionPoint
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3586
    ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3587
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3588
    "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
  3589
    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
  3590
    direction notNil ifTrue:[
3975
ca
parents: 3966
diff changeset
  3591
        self pointerEntersItem:nil.
ca
parents: 3966
diff changeset
  3592
ca
parents: 3966
diff changeset
  3593
        self sensor anyButtonPressed ifTrue:[
ca
parents: 3966
diff changeset
  3594
            self scrollActivity startIfRequiredAt:direction on:self comesViaButtonPress:false.
ca
parents: 3966
diff changeset
  3595
        ].
ca
parents: 3966
diff changeset
  3596
        ^ self
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3597
    ].
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3598
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3599
    self pointerEntersItem:item.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3600
1910
119f91172b70 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1902
diff changeset
  3601
    (state == 0 or:[self sensor anyButtonPressed not]) ifTrue:[
3975
ca
parents: 3966
diff changeset
  3602
        (     self selectionFollowsMouse
ca
parents: 3966
diff changeset
  3603
         and:[self topMenu focusComesByTab not]
ca
parents: 3966
diff changeset
  3604
        ) ifTrue:[
ca
parents: 3966
diff changeset
  3605
            self isPopUpView ifTrue:[
ca
parents: 3966
diff changeset
  3606
                item isNil ifTrue:[
ca
parents: 3966
diff changeset
  3607
                    superMenu notNil ifTrue:[
ca
parents: 3966
diff changeset
  3608
                        translatedPoint := self translateMenuPoint:motionPoint toMenu:superMenu.
ca
parents: 3966
diff changeset
  3609
                        superMenu handleButtonMotion:state atPoint:translatedPoint.
ca
parents: 3966
diff changeset
  3610
                    ]
ca
parents: 3966
diff changeset
  3611
                ] ifFalse:[
ca
parents: 3966
diff changeset
  3612
                    self selectAndOpenDelayed:item.
ca
parents: 3966
diff changeset
  3613
                ].
ca
parents: 3966
diff changeset
  3614
            ] ifFalse:[ "/ processing in the toolbar
ca
parents: 3966
diff changeset
  3615
                (item notNil and:[self hasSelection and:[item canSelect]]) ifTrue:[
ca
parents: 3966
diff changeset
  3616
                    self selection:item openMenu:true.
ca
parents: 3966
diff changeset
  3617
                ].
ca
parents: 3966
diff changeset
  3618
            ].
ca
parents: 3966
diff changeset
  3619
        ].
ca
parents: 3966
diff changeset
  3620
        ^ self
ca
parents: 3966
diff changeset
  3621
    ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3622
    containsPoint ifTrue:[
3975
ca
parents: 3966
diff changeset
  3623
        self selection:item openMenu:true.
ca
parents: 3966
diff changeset
  3624
        ^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3625
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3626
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3627
    menu := self superMenuAtPoint:motionPoint.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3628
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3629
    menu notNil ifTrue:[
3975
ca
parents: 3966
diff changeset
  3630
        translatedPoint := self translateMenuPoint:motionPoint toMenu:menu.
ca
parents: 3966
diff changeset
  3631
        menu handleButtonMotion:state atPoint:translatedPoint.
ca
parents: 3966
diff changeset
  3632
        ^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3633
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3634
    self isPopUpView ifTrue:[
3975
ca
parents: 3966
diff changeset
  3635
        self selection:nil
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3636
    ].
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3637
!
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3638
3383
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  3639
handleButtonPress:button atPoint:aPoint
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3640
    "a button pressed; open or close the corresponding submenus"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3641
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3642
    |item scrollerDirectionOrNil wasSelected|
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3643
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3644
    item := self itemAtPoint:aPoint.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3645
    item isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3646
	self selection:nil openMenu:false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3647
	^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3648
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3649
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3650
    "/ is a scroller-button present and hit ?
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3651
    scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3652
    scrollerDirectionOrNil notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3653
	(self scrollActivity startIfRequiredAt:scrollerDirectionOrNil on:self comesViaButtonPress:true) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3654
	    self pointerEntersItem:nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3655
	    ^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3656
	]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3657
    ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3658
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3659
    "/ right button always immediately pulls the delayedMenu
3383
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  3660
    button == 2 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3661
	item hasDelayedMenu ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3662
	    self selection:item openMenu:false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3663
	    self openDelayed:item afterSeconds:0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3664
	    ^ self.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3665
	].
3383
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  3666
    ].
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  3667
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3668
    wasSelected := (selection == item).
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3669
    wasSelected ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3670
	self selection:item openMenu:true
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3671
    ].
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3672
    item hasDelayedMenu ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3673
	"/ clicked on the arrow icon ?
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3674
	(item menuIndicatorContains:aPoint) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3675
	    self selection:item openMenu:false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3676
	    self openDelayed:item afterSeconds:0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3677
	    ^ self.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3678
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3679
	^ self
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3680
    ].
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3681
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3682
    (item isToggle or:[item triggerOnDown]) ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3683
	(wasSelected and:[item hasSubmenu and:[item visibleSubmenu isNil]]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3684
	    item toggleSubmenuVisibility
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3685
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
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
    (item canAccept and:[item == self selection]) ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3689
	^ self
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3690
    ].
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3691
    self invalidateItem:item repairNow:true.
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3692
    self acceptItem:item inMenu:self.
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3693
3233
50bec260bddc bugfix - waiting for anyButtonPressede not
ca
parents: 3224
diff changeset
  3694
    [ (device notNil and:[device anyButtonPressed]) ] whileTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3695
	"/ using device - sensor is not updated sometimes
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3696
	Delay waitForSeconds:0.1.
3233
50bec260bddc bugfix - waiting for anyButtonPressede not
ca
parents: 3224
diff changeset
  3697
    ].
50bec260bddc bugfix - waiting for anyButtonPressede not
ca
parents: 3224
diff changeset
  3698
    self sensor flushUserEvents.
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3699
    self selection:nil.
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3700
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3701
    "Created: / 13.11.2001 / 14:12:04 / cg"
2047
62de65e3a61b initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents: 2046
diff changeset
  3702
    "Modified: / 13.11.2001 / 19:50:52 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3703
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3704
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3705
handleCursorKey:aKey
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3706
    "handle a cursor key"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3707
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3708
    |next menu item isVrt backKey p1 p2
2354
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3709
     idx0  "{ Class:SmallInteger }"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3710
     idx   "{ Class:SmallInteger }"
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3711
     size  "{ Class:SmallInteger }"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3712
    |
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3713
    (size  := items size) == 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3714
	superMenu notNil ifTrue:[superMenu handleCursorKey:aKey].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3715
	^ self
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3716
    ].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3717
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3718
    isVrt := self verticalLayout.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3719
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3720
    (    (isVrt     and:[aKey == #CursorUp    or:[aKey == #CursorDown]])
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3721
     or:[(isVrt not and:[aKey == #CursorRight or:[aKey == #CursorLeft]])]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3722
    ) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3723
	selection isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3724
	    (superMenu notNil and:[superMenu verticalLayout == isVrt]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3725
		^ superMenu handleCursorKey:aKey
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3726
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3727
	    idx := 0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3728
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3729
	    isVrt ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3730
		"/ used because of vertical scrolling
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3731
		idx := items findFirst:[:el| el layout top > 0 ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3732
		idx ~~ 0 ifTrue:[idx := idx - 1 ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3733
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3734
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3735
	    idx := self indexOf:selection.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3736
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3737
	next := aKey == #CursorRight or:[aKey == #CursorDown].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3738
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3739
	idx0 := idx.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3740
	size timesRepeat:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3741
	    |el|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3742
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3743
	    next ifTrue:[idx := idx + 1] ifFalse:[idx := idx - 1].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3744
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3745
	    idx > size ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3746
		idx := 0 "1"
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3747
	    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3748
		idx < 0 ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3749
		    idx := size
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3750
		]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3751
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3752
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3753
	    idx == 0 ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3754
		self selection:nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3755
		^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3756
	    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3757
		(el := items at:idx ifAbsent:nil) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3758
		    el canSelect ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3759
			el hasDelayedMenu ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3760
			    "/ do not open menu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3761
			    self selection:el openMenu:false
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3762
			] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3763
			    "/ open comes from style-sheet
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3764
			    self selection:el.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3765
			].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3766
			^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3767
		    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3768
		]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3769
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3770
	    idx == idx0 ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3771
		^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3772
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3773
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3774
	^ self
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3775
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3776
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3777
    superMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3778
	p1 := self translateGrabPoint:0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3779
	p2 := superMenu translateGrabPoint:0.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3780
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3781
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3782
    isVrt ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3783
	(superMenu notNil and:[p1 x > p2 x]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3784
	    backKey := #CursorRight
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3785
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3786
	    backKey := #CursorLeft.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3787
	]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3788
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3789
	(superMenu notNil and:[p1 y > p2 y]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3790
	    backKey := #CursorDown
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3791
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3792
	    backKey := #CursorUp.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3793
	]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3794
    ].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3795
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3796
    aKey == backKey ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3797
	superMenu isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3798
	    self accept:nil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3799
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3800
	    superMenu verticalLayout ~~ isVrt ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3801
		superMenu handleCursorKey:aKey
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3802
	    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3803
		superMenu selection hideSubmenu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3804
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3805
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3806
	^ self
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3807
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3808
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3809
    selection isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3810
	superMenu isNil ifTrue:[^ self accept:nil].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3811
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3812
	superMenu verticalLayout ~~ isVrt ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3813
	    superMenu handleCursorKey:aKey
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3814
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3815
	    (item := items findFirst:[:el| el canSelect]) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3816
		self selectionIndex:item
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3817
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3818
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3819
	^ self
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3820
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3821
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3822
    selection hasSubmenu ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3823
	(menu := selection visibleSubmenu) isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3824
	    selection toggleSubmenuVisibility
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3825
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3826
	    menu selectionIndex:1
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3827
	]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3828
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3829
	superMenu notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3830
	    superMenu verticalLayout ~~ isVrt ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3831
		superMenu handleCursorKey:aKey
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3832
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3833
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3834
	    self accept:nil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3835
	]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3836
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3837
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3838
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3839
handleKeyPress:key
4167
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  3840
    <resource: #keyboard (#CursorDown #CursorUp #CursorLeft #CursorRight #Return)>
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  3841
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3842
    "any key is pressed"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3843
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3844
    |item inMenu|
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3845
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3846
    (key == #Return or:[key == Character space]) ifTrue:[
4167
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  3847
        self handleReturnPressed.
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  3848
        ^ true.
3754
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  3849
    ].
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  3850
    key isCharacter ifTrue:[
1862
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  3851
"/            selection notNil ifTrue:[
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  3852
"/                inMenu := self
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  3853
"/            ] ifFalse:[
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  3854
"/                (inMenu := superMenu) isNil ifTrue:[^ self].
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  3855
"/            ].
4167
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  3856
        inMenu := self.
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  3857
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  3858
        (item := inMenu detectItemForKey:key) notNil ifTrue:[
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  3859
            inMenu selection:item
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  3860
        ].
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  3861
        ^ true
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3862
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3863
    (key == #CursorDown
4167
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  3864
        or:[key == #CursorUp
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  3865
        or:[key == #CursorLeft
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  3866
        or:[key == #CursorRight]]])
3754
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  3867
    ifTrue:[
4167
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  3868
        self handleCursorKey:key.
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  3869
        ^ true
3754
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  3870
    ].
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  3871
    ^ false.
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3872
!
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3873
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3874
handlePointerLeave:state
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3875
    self  pointerEntersItem:nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3876
    super pointerLeave:state
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3877
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3878
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3879
handleReturnPressed
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3880
    "any key is pressed"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3881
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3882
    |sensor subm item|
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3883
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3884
    (item := selection) isNil ifTrue:[
4089
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3885
        superMenu notNil ifTrue:[
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3886
            item := superMenu selection.
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3887
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3888
            item value notNil ifTrue:[
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3889
                "/ is a delayed menu
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3890
                self accept:item
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3891
            ] ifFalse:[
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3892
                item toggleSubmenuVisibility
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3893
            ]
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3894
        ] ifFalse:[
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3895
            self accept
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3896
        ].
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3897
        ^ self
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3898
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3899
    selection hasSubmenu ifTrue:[
4089
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3900
        selection hasDelayedMenu ifFalse:[
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3901
            selection toggleSubmenuVisibility.
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3902
          ^ self
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3903
        ].
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3904
        subm := selection currentSubmenu.
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3905
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3906
        (subm notNil and:[subm shown]) ifTrue:[
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3907
            selection toggleSubmenuVisibility.
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3908
          ^ self
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3909
        ].
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3910
        self openDelayed:nil
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3911
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3912
    self accept.
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3913
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3914
    " test for toggle "
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3915
    item isToggle ifTrue:[
4089
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3916
        self selection:item.
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3917
    ] ifFalse:[
4089
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3918
        (selection notNil and:[selection triggerOnDown]) ifFalse:[
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3919
            ^ self
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3920
        ]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3921
    ].
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3922
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3923
    (sensor := self sensor) isNil ifTrue:[
4089
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3924
        ^ self
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3925
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3926
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3927
    [
4089
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3928
        sensor flushKeyboardFor:nil.
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3929
        Delay waitForSeconds:0.1.
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  3930
        sensor hasKeyPressEventFor:nil.
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3931
    ] whileTrue.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3932
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3933
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3934
pointerEntersItem:anItemOrNil
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3935
    "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
  3936
     redraw the new item highlighted."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3937
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3938
    |oldItem newItem|
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3939
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3940
    (     anItemOrNil notNil
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3941
     and:[anItemOrNil canSelect
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3942
     and:[selection isNil
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3943
     and:[self isPopUpView not]]]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3944
	anItemOrNil isButton ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3945
	    (    self buttonEnteredBackgroundColor ~= self buttonPassiveBackgroundColor
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3946
	     or:[self buttonEnteredLevel ~= self buttonPassiveLevel]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3947
	    ) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3948
		newItem := anItemOrNil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3949
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3950
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3951
	    (self enteredLevel ~~ 0
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3952
	      or:[self enteredBackgroundColor ~= self backgroundColor]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3953
	    ) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3954
		newItem := anItemOrNil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3955
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3956
	]
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3957
    ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3958
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3959
    newItem ~~ enteredItem ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3960
	oldItem     := enteredItem.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3961
	enteredItem := newItem.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3962
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3963
	oldItem notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3964
	    self invalidateItem:oldItem repairNow:(enteredItem isNil).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3965
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3966
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3967
	enteredItem notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3968
	    self invalidateItem:enteredItem repairNow:true.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3969
	].
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3970
    ].
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3971
!
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3972
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3973
processHideMenuEvent:ev
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3974
    "to be filled..."
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3975
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3976
    "Modified: / 29-06-2011 / 16:39:36 / cg"
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3977
!
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3978
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3979
processMenuEnterItemEvent:ev
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3980
    "to be filled..."
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3981
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3982
    "Created: / 29-06-2011 / 13:18:05 / cg"
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3983
    "Modified: / 29-06-2011 / 16:39:29 / cg"
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3984
!
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3985
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3986
processMenuSelectItemEvent:ev
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3987
    |winGrp masterGroup winGrpForBusyCursor item itemIndex itemValue menuReceiver acceptAction|
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3988
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3989
    winGrp := self windowGroup.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3990
    winGrp notNil ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3991
        masterGroup := winGrp previousGroup.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3992
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3993
    winGrpForBusyCursor := masterGroup ? winGrp.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3994
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3995
    item := ev item.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3996
    itemIndex := ev itemIndex.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3997
    itemValue := ev itemValue.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3998
    menuReceiver := ev menuReceiver.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3999
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4000
    acceptAction := [ self accept:item index:itemIndex toggle:itemValue receiver:menuReceiver ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4001
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4002
    (item showBusyCursorWhilePerforming
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4003
    and:[winGrpForBusyCursor notNil])
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4004
    ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4005
        winGrpForBusyCursor withWaitCursorDo:acceptAction
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4006
    ] ifFalse:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4007
        acceptAction value
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4008
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4009
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4010
    "Modified: / 29-06-2011 / 16:32:36 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4011
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4012
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4013
!MenuPanel methodsFor:'focus handling'!
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4014
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4015
canTab
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4016
    "depends whether I'am a toolbar and selectable items exists
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4017
    "
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4018
    |selectableItem|
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4019
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4020
    (super canTab and:[self isPopUpView not]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4021
	selectableItem := self firstItemSelectable.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4022
	^ selectableItem notNil
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4023
    ].
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4024
    ^ false
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4025
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4026
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4027
focusComesByTab
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4028
    "returns true if focus comes by tab and should be drawn"
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4029
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4030
    focusComesByTab == true ifTrue:[
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4031
        (shown and:[self hasFocus]) ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4032
            ^ true
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4033
        ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4034
        focusComesByTab := false.
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4035
    ].
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4036
    ^ false
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4037
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4038
    "Modified: / 29-06-2011 / 16:23:09 / cg"
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4039
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4040
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4041
focusComesByTab:aBoolean
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4042
    "only handled for toolBars"
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4043
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4044
    |selectableItem|
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4045
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4046
    (self supportsFocusOnTab and:[self isPopUpView not]) ifTrue:[
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4047
        focusComesByTab := aBoolean.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4048
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4049
        self hasSelection ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4050
            ^ self
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4051
        ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4052
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4053
        aBoolean ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4054
            selectableItem := self firstItemSelectable.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4055
        ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4056
        self selection:selectableItem openMenu:false.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4057
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4058
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4059
    "Modified: / 29-06-2011 / 16:23:19 / cg"
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4060
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4061
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4062
hasKeyboardFocus:aBoolean
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4063
    "notification from the windowGroup that I got/lost the keyboard focus."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4064
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4065
    |focusView|
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4066
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4067
    self isPopUpView ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4068
	"/ not visible for popup menus
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4069
	^ super hasKeyboardFocus:aBoolean
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4070
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4071
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4072
    (aBoolean not and:[selection notNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4073
	hasImplicitGrap ~~ true ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4074
	    focusView := windowGroup focusView.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4075
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4076
	    focusView == self ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4077
		self selection:nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4078
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4079
	]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4080
    ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4081
    super hasKeyboardFocus:aBoolean.
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4082
!
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4083
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4084
showFocus:focusComesByTab
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4085
    self focusComesByTab:focusComesByTab.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4086
    super showFocus:focusComesByTab.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4087
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4088
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4089
showNoFocus:focusByTab
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4090
    self focusComesByTab:false.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4091
    super showNoFocus:focusByTab.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4092
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4093
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4094
supportsFocusOnTab
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4095
    "returns true if focus is supported
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4096
    "
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4097
    ^ (styleSheet at:#'focusHighlightStyle') == #win95
3158
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  4098
!
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  4099
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  4100
wantsFocusWithButtonPress
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4101
    "needs only the focus if I'am a toolbar; all events are delegated
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4102
     to my subMenus"
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4103
4153
2de187bba3f8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4152
diff changeset
  4104
"/ old:
2de187bba3f8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4152
diff changeset
  4105
"/    ^ self isPopUpView not
2de187bba3f8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4152
diff changeset
  4106
2de187bba3f8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4152
diff changeset
  4107
    "/ no longer - it turned out to be counter-productive
2de187bba3f8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4152
diff changeset
  4108
    self isPopUpView ifTrue:[^ false].
2de187bba3f8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4152
diff changeset
  4109
    ^ UserPreferences current menuPanelTakesFocusOnClick.
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4110
! !
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4111
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4112
!MenuPanel methodsFor:'grabbing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4113
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4114
doGrab
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4115
    relativeGrabOrigin := nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4116
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4117
    superMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4118
	superMenu doGrab
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4119
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4120
	hasImplicitGrap ~~ true ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4121
	    self grabMouseAndKeyboard.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4122
	    hasImplicitGrap := true
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4123
	]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4124
    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4125
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4126
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4127
doUngrab:forceDo
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4128
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4129
    relativeGrabOrigin := nil.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4130
    self clearImplicitGrab.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4131
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4132
    superMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4133
	forceDo ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4134
	    superMenu doUngrab:true
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4135
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4136
	^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4137
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4138
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4139
    hasImplicitGrap ~~ true ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4140
	^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4141
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4142
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4143
    forceDo ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4144
	(selection notNil or:[prevFocusView == self]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4145
	    ^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4146
	].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4147
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4148
    self ungrabMouseAndKeyboard.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4149
    self selection:nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4150
    hasImplicitGrap := nil.
1703
e127eff742bb bugfix: request focus
ca
parents: 1701
diff changeset
  4151
    prevFocusView   := nil.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4152
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4153
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4154
grabKeyboard
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4155
    "grap the keyboard; keep previous grab"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4156
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4157
    previousKeyboardGrab := device activeKeyboardGrab.
2713
9e417aa397c0 *** empty log message ***
ca
parents: 2712
diff changeset
  4158
    ^ super grabKeyboard
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4159
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4160
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4161
grabMouseAndKeyboard
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  4162
    "get exclusive access to pointer and keyboard"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  4163
3754
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4164
    |winGroup sensor activeGrab|
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4165
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4166
    winGroup := self windowGroup.
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4167
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4168
    (realized and:[winGroup notNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4169
	prevFocusView isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4170
	     prevFocusView := winGroup focusView.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4171
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4172
	sensor := self sensor.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4173
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4174
	device activePointerGrab ~~ self ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4175
	    sensor flushMotionEventsFor:nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4176
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4177
	    (self grabPointer) ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4178
		Delay waitForSeconds:0.1.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4179
		(self grabPointer) ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4180
		    "give up"
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4181
		    'MenuPanel [warning]: could not grab pointer' errorPrintCR.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4182
		    self unmap
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4183
		]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4184
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4185
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4186
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4187
	(activeGrab := device activeKeyboardGrab) ~~ self ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4188
	    device sync.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4189
	    "/ cg: mhmh - should we flush for all or for the activeGrab only ?
3754
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4190
"/            activeGrab notNil ifTrue:[
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4191
"/                sensor flushKeyboardFor:activeGrab.
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4192
"/            ].
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4193
	    sensor flushKeyboardFor:nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4194
	    self grabKeyboard.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4195
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4196
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4197
3158
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  4198
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  4199
    "Modified: / 2.2.1998 / 23:43:59 / stefan"
1254
38b8bcfabbd7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1253
diff changeset
  4200
    "Modified: / 15.3.1999 / 12:01:38 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4201
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4202
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4203
grabPointerWithCursor:aCursorOrNil
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4204
    "grap the pointer; keep previous grab"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4205
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4206
    previousPointerGrab := device activePointerGrab.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4207
    hasImplicitGrap := true.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4208
    ^ super grabPointerWithCursor:aCursorOrNil
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4209
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4210
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4211
ungrabKeyboard
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4212
    "ungrap the keyboard; restore previous grab"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4213
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4214
    super ungrabKeyboard.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4215
2579
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  4216
    (previousKeyboardGrab notNil
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  4217
    and:[ previousKeyboardGrab realized ]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4218
	device grabKeyboardInView:previousKeyboardGrab.
2579
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  4219
    ].
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4220
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4221
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4222
ungrabMouseAndKeyboard
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4223
    "ungrab resources (mouse and keyboard)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4224
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4225
    self ungrabPointer.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4226
    self ungrabKeyboard.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4227
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4228
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4229
ungrabPointer
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4230
    "ungrap the pointer; restore previous grab"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4231
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4232
    super ungrabPointer.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4233
2579
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  4234
    (previousPointerGrab notNil
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  4235
    and:[ previousPointerGrab realized ]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4236
	device grabPointerInView:previousPointerGrab.
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4237
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4238
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4239
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4240
!MenuPanel methodsFor:'help'!
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4241
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4242
flyByHelpSpec
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4243
    "allows subclasses to provide texts"
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4244
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4245
    ^ IdentityDictionary new
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4246
!
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4247
3695
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4248
flyByHelpTextAt:aPoint
2058
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  4249
    "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
  4250
     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
  4251
3695
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4252
    |scrollerDirectionOrNil|
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4253
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4254
    "/ is a scroller-button present and hit ?
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4255
    scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint.
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4256
    scrollerDirectionOrNil notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4257
	^ 'Scroll Menu Items'
3695
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4258
    ].
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4259
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4260
    self withMenuAndItemAt:aPoint do:[:menu :item | ^ menu flyByHelpTextForItem:item].
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4261
    ^ nil
2058
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  4262
!
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  4263
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  4264
flyByHelpTextForItem:anItem
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4265
    "returns the helpText for an item (empty if none)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4266
2063
8bff9e49f1e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2062
diff changeset
  4267
    anItem isNil ifTrue:[^ nil].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  4268
    ^ anItem flyByHelpText.
2058
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  4269
!
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  4270
3402
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4271
flyByHelpTextForKey:aKey
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4272
    |app text|
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4273
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4274
    app := self application.
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4275
    app notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4276
	text := self application flyByHelpTextForKey:aKey.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4277
	text notNil ifTrue:[^ text].
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4278
    ].
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4279
    ^ 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
  4280
!
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4281
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4282
helpText
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4283
    "return the helpText for the currently selected item (empty if none)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4284
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4285
    ^ self helpTextForItem:selection
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4286
!
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4287
3695
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4288
helpTextAt:aPoint
1252
6db6906da49b debug print
Claus Gittinger <cg@exept.de>
parents: 1251
diff changeset
  4289
    "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
  4290
     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
  4291
3695
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4292
    |scrollerDirectionOrNil|
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4293
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4294
    "/ is a scroller-button present and hit ?
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4295
    scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint.
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4296
    scrollerDirectionOrNil notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4297
	^ 'Scroll Menu Items'
3695
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4298
    ].
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4299
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4300
    self withMenuAndItemAt:aPoint 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
  4301
    ^ nil
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4302
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4303
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4304
helpTextForItem:anItem
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4305
    "returns the helpText for an item (empty if none)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4306
2884
6e060df8f158 fix: MUST return nil, if there is no help text (not empty string !)
Claus Gittinger <cg@exept.de>
parents: 2883
diff changeset
  4307
    anItem isNil ifTrue:[^ nil].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  4308
    ^ anItem activeHelpText.
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4309
!
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4310
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4311
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
  4312
    |dstMenu dstPoint item|
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4313
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4314
    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
  4315
    dstMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4316
	dstPoint := dstMenu translateGrabPoint:srcPoint.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4317
	item := dstMenu itemAtPoint:dstPoint.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4318
	aBlock value:dstMenu value:item.
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4319
    ]
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4320
! !
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4321
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4322
!MenuPanel methodsFor:'image registration'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4323
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  4324
imageOnMyDevice:anImage
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4325
    "returns image registered on device"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4326
2770
d46f94ddabef *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2768
diff changeset
  4327
    ^ self class image:anImage value onDevice:device
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4328
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4329
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4330
lightenedImageOnDevice:anImage
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4331
    "returns lightened image registered on device"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4332
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4333
    ^ self class lightenedImage:anImage onDevice:device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4334
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4335
1688
271829d6a2e4 category changes
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  4336
!MenuPanel methodsFor:'initialization & release'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4337
767
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  4338
addToCurrentProject
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  4339
    "ignored here"
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  4340
!
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  4341
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4342
create
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4343
    "create the shadow view for a none contained submenu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4344
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4345
    super create.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4346
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4347
    self isPopUpView ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4348
	(PopUpView shadowsOnDevice:device) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4349
	    shadowView isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4350
		shadowView := (ShadowView onDevice:device) for:self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4351
	    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4352
		self saveUnder:true.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4353
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4354
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4355
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4356
	self hasExplicitExtent ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4357
	    (self width) == (superView width) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4358
		self verticalLayout:false
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4359
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4360
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4361
    ]
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  4362
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  4363
    "Modified: / 28.7.1998 / 02:11:44 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4364
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4365
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4366
destroy
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4367
    "destroy items and shadowView; remove dependencies"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4368
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4369
    self clearLastActiveMenu.
2051
d958c12cc08e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  4370
    items notNil ifTrue:[items copy do:[:el|el destroy]].
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  4371
    items := nil.
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  4372
    self removeDependencies.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4373
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4374
    super destroy.
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4375
    prevFocusView := superMenu := nil.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4376
    shadowView notNil ifTrue:[shadowView destroy].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4377
2051
d958c12cc08e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  4378
    "Modified: / 15.11.2001 / 17:08:45 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4379
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4380
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4381
fetchDeviceResources
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4382
    "fetch device colors, to avoid reallocation at redraw time"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4383
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4384
    |style|
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4385
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4386
    superMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4387
	styleSheet := superMenu styleSheet
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4388
    ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4389
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4390
    super fetchDeviceResources.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4391
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4392
    "/ 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
  4393
    "/ (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
  4394
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4395
    superMenu isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4396
	rightArrow isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4397
	    rightArrow := SelectionInListView rightArrowFormOn:device.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4398
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4399
	fgColor := fgColor onDevice:device.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4400
	style   := styleSheet name.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4401
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4402
	(style ~~ #os2 and:[style ~~ #win95 and:[style ~~ #winXP]]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4403
	    rightArrowShadow := SelectionInListView rightArrowShadowFormOn:device
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4404
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4405
	    rightArrowShadow := nil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4406
	].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4407
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4408
	rightArrow       := superMenu rightArrow.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4409
	rightArrowShadow := superMenu rightArrowShadow.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4410
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4411
	self foregroundColor:(superMenu foregroundColor).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4412
	self             font:(superMenu font).
2761
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  4413
"/        self  viewBackground:(superMenu viewBackground).
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  4414
    ].
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  4415
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  4416
    items notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4417
	items do:[:eachItem| eachItem fetchDeviceResources ]
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  4418
    ].
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  4419
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  4420
    "Modified: / 15.9.1998 / 12:51:29 / cg"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4421
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4422
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4423
initStyle
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4424
    "initialize style specific stuff"
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4425
2919
0c83b23cb6c6 resource directive
Claus Gittinger <cg@exept.de>
parents: 2895
diff changeset
  4426
    <resource: #style (#'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace'
4061
7f2ab09c5702 changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4427
                       #'menu.buttonItemVerticalSpace'   #'menu.itemSpace'
7f2ab09c5702 changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4428
                       #'menu.itemHorizontalSpace'
7f2ab09c5702 changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4429
                       #'popup.hideOnRelease'
7f2ab09c5702 changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4430
                       )>
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  4431
    |fn|
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  4432
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4433
    super initStyle.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4434
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4435
    buttonInsetX := styleSheet at:#'menu.buttonItemHorizontalSpace'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4436
    buttonInsetX isNil ifTrue:[ buttonInsetX := styleSheet at:#'menu.buttonItemSpace' default:0 ].
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4437
    buttonInsetX := buttonInsetX abs.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4438
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4439
    buttonInsetY := styleSheet at:#'menu.buttonItemVerticalSpace'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4440
    buttonInsetY isNil ifTrue:[ buttonInsetY := styleSheet at:#'menu.buttonItemSpace' default:0 ].
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4441
    buttonInsetY := buttonInsetY abs.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4442
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4443
    itemSpace := styleSheet at:#'menu.itemHorizontalSpace'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4444
    itemSpace isNil ifTrue:[ itemSpace := styleSheet at:#'menu.itemSpace' default:[ font widthOf:' '] ].
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4445
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4446
4061
7f2ab09c5702 changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4447
    fgColor := DefaultForegroundColor.
7f2ab09c5702 changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4448
    fgColor isNil ifTrue:[ fgColor := Color black ].
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  4449
    DefaultBackgroundColor notNil ifTrue:[ viewBackground := DefaultBackgroundColor ].
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  4450
    fn := self class defaultFont.
2610
a30fc1fb35d7 *** empty log message ***
ca
parents: 2609
diff changeset
  4451
    fn notNil ifTrue:[ self font:fn ].
1923
530426a3d692 support #level:
ca
parents: 1922
diff changeset
  4452
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4453
    defaultHideOnRelease := styleSheet at:#'popup.hideOnRelease' default:true.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4454
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  4455
    buttonActiveBackgroundColor := styleSheet colorAt:#'button.activeBackgroundColor'.
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  4456
    buttonEnteredBackgroundColor := styleSheet colorAt:#'button.buttonEnteredBackgroundColor'.
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  4457
    buttonPassiveBackgroundColor := styleSheet colorAt:#'button.buttonPassiveBackgroundColor'.
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  4458
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4459
    self updateLevelAndBorder.
4061
7f2ab09c5702 changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4460
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  4461
    "Modified (format): / 19-01-2012 / 13:19:19 / cg"
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4462
!
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4463
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4464
initialize
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4465
    "set default configuration"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4466
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4467
    super initialize.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4468
2877
6f7df547445b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  4469
    self enableMotionEvents.  "/ for flyByHelp
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  4470
    enabled := true.
3881
0db3473b4eca changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 3878
diff changeset
  4471
    self originChangedFlag:false extentChangedFlag:false.
3334
50374a42b3d9 use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents: 3332
diff changeset
  4472
    "/ explicitExtent      := nil.
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4473
    shortKeyInset       := 0.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4474
    mustRearrange       := false.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4475
    showSeparatingLines := false.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4476
    showGroupDivider    := true.
3780
14184c505e24 changed:
Claus Gittinger <cg@exept.de>
parents: 3754
diff changeset
  4477
    hideOnRelease := defaultHideOnRelease.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4478
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4479
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  4480
map
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4481
    "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
  4482
     If the grab fails, try again and unmap myself if that fails too."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4483
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4484
    |loIndices loItems|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4485
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4486
    enteredItem := nil.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4487
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  4488
    self enableMotionEvents.
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4489
    self becomesActiveMenu.
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  4490
    super map.
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  4491
    self addDependencies.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4492
1785
efa4cc8ca917 mnemonic behaviour changed
ca
parents: 1775
diff changeset
  4493
    loIndices := InitialSelectionQuerySignal query.
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4494
    loItems   := items ? #[].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4495
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4496
    loItems do:[:anItem| anItem fetchImages ].
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4497
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4498
    self isPopUpView ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4499
	self doGrab
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4500
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4501
	super viewBackground:(self backgroundColor).
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  4502
    ].
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4503
    loItems do:[:el| el updateIndicators ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4504
1785
efa4cc8ca917 mnemonic behaviour changed
ca
parents: 1775
diff changeset
  4505
    loIndices size > 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4506
	self redrawX:0 y:0 width:width height:height.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4507
	self openMenusFromItemIndices:loIndices.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4508
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4509
1177
cfd7f71639f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1164
diff changeset
  4510
    "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
  4511
    "Modified: / 18.3.1999 / 18:22:18 / stefan"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4512
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4513
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4514
realize
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4515
    "realize menu and shadowView"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4516
2761
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  4517
    |bgColor|
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  4518
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4519
    self isPopUpView ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4520
	bgColor := styleSheet colorAt:'menu.backgroundColor'.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4521
	bgColor notNil ifTrue:[ self viewBackground:bgColor ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4522
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4523
	"Because of #saveUnder of ShadowView the order of realize is significant:
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4524
	 shadowView must be realized before self"
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4525
	self hiddenOnRealize:true.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4526
	super realize.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4527
	self resize.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4528
	self makeFullyVisible.
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4529
"/        self mustRearrange.
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4530
	shadowView notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4531
	    shadowView realize.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4532
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4533
	self raise.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4534
	self map.
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  4535
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4536
	super realize.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4537
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4538
    self allSubViewsDo:[:aView| aView realize ].
3780
14184c505e24 changed:
Claus Gittinger <cg@exept.de>
parents: 3754
diff changeset
  4539
    "/ hideOnRelease := defaultHideOnRelease.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4540
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4541
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4542
recreate
1832
f6e6640e99a3 comment
Claus Gittinger <cg@exept.de>
parents: 1829
diff changeset
  4543
    "this is called after a snapin or a migration.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4544
     If the image was saved with an active menu, hide the menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4545
1455
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  4546
    selection := nil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4547
    super recreate.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4548
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4549
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4550
reinitStyle
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4551
    "handle style change while being open (win32 only - for now)"
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4552
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4553
    super reinitStyle.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4554
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4555
    self fetchDeviceResources.
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  4556
    self mustRearrange.      "/ care for changed font sizes etc.
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  4557
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  4558
    self do:[:anItem |
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4559
	anItem reinitStyle
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  4560
    ].
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4561
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4562
    "Created: / 10.9.1998 / 21:37:05 / cg"
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  4563
    "Modified: / 17.8.2000 / 18:01:33 / cg"
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4564
!
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4565
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4566
unmap
1330
63d2fe5ebd48 comment
Claus Gittinger <cg@exept.de>
parents: 1313
diff changeset
  4567
    "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
  4568
     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
  4569
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  4570
    mapTime := nil.
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  4571
3975
ca
parents: 3966
diff changeset
  4572
    "hide all submenus opened within the menu"
ca
parents: 3966
diff changeset
  4573
    self itemsDo:[:eachItem|
ca
parents: 3966
diff changeset
  4574
        eachItem visibleSubmenu notNil ifTrue:[ eachItem hideSubmenu ].
ca
parents: 3966
diff changeset
  4575
    ].
ca
parents: 3966
diff changeset
  4576
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  4577
    self removeDependencies.
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4578
    self clearLastActiveMenu.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4579
    self doUngrab:(superMenu isNil).
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4580
"/    self isPopUpView ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4581
"/         self doUngrab:(superMenu isNil)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4582
"/    ].
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4583
    prevFocusView := nil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4584
    super unmap.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4585
    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
  4586
!
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4587
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4588
updateLevelAndBorder
3820
8767ab1e2a24 borderColor from styleSheet
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  4589
    "update level & border"
8767ab1e2a24 borderColor from styleSheet
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  4590
8767ab1e2a24 borderColor from styleSheet
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  4591
    <resource: #style (#'popup.borderWidth'
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4592
		       #'popup.borderColor'
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4593
		       #'popup.level'
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4594
		       #'pullDownMenu.level'
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4595
		       )>
3820
8767ab1e2a24 borderColor from styleSheet
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  4596
8767ab1e2a24 borderColor from styleSheet
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  4597
    |bw bc lvl|
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4598
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4599
    self isPopUpView ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4600
	bw  := styleSheet at:#'popup.borderWidth' default:1.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4601
	lvl := styleSheet at:#'popup.level'       default:0.
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4602
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4603
	bw  := styleSheet is3D ifFalse:[1] ifTrue:[0].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4604
	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
  4605
    ].
3823
81781fb283b5 changed: #updateLevelAndBorder
Claus Gittinger <cg@exept.de>
parents: 3820
diff changeset
  4606
    bw ~~ 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4607
	bc  := styleSheet at:#'popup.borderColor' default:Color black.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4608
	self borderColor:bc
3823
81781fb283b5 changed: #updateLevelAndBorder
Claus Gittinger <cg@exept.de>
parents: 3820
diff changeset
  4609
    ].
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4610
    self borderWidth:bw.
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4611
    self level:lvl.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4612
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4613
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4614
!MenuPanel methodsFor:'keyboard control'!
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4615
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4616
mnemonicViewNext:aKeyEvent
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4617
    "a  mnemonicKey event as forwarded from the keyboardProcessor - if there
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4618
     is the mnemonic-key defined for any menuItem, handle the menuItem and
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4619
     return the topMenu otherwise nil."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4620
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4621
    |menu uKey lKey list index accessCharacterMatchQuery maxShortCutSearchLevel|
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4622
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4623
    superMenu notNil ifTrue:[ ^ superMenu mnemonicViewNext:aKeyEvent ].
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4624
    shown ifFalse:[^ nil].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4625
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4626
    uKey := aKeyEvent rawKey last asUppercase.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4627
    lKey := uKey asLowercase.
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4628
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4629
    accessCharacterMatchQuery := 
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4630
        [:el|
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4631
            |k|
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4632
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4633
            k := el accessCharacter.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4634
            k == uKey or:[k == lKey]
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4635
        ].
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4636
    maxShortCutSearchLevel := self class maxShortCutSearchLevel.
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4637
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4638
    selection notNil ifTrue:[
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4639
        "first lookup the current grapMenu before starting in the topMenu
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4640
        "
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4641
        menu := self detectGrabMenu.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4642
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4643
        [ menu ~~ self ] whileTrue:[
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4644
            index := menu selectionIndex.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4645
            list  := menu
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4646
                        selectItemIndicesFor:accessCharacterMatchQuery
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4647
                        maxDepth:maxShortCutSearchLevel from:(index + 1) to:99999
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4648
                        ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ].
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4649
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4650
            list size ~~ 0 ifTrue:[
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4651
                "/ has item which responds to the mnemonic
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4652
                menu processCollectedShortcutIndices:list.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4653
                ^ self
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4654
            ].
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4655
            menu := menu superMenu.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4656
        ].
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4657
        index := self selectionIndex.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4658
        list  := self
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4659
                    selectItemIndicesFor:accessCharacterMatchQuery
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4660
                    maxDepth:maxShortCutSearchLevel from:(1 + index) to:99999
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4661
                    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
  4662
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4663
    ] ifFalse:[
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4664
        index := 99999.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4665
        list  := nil.
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4666
    ].
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4667
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4668
    list isNil ifTrue:[
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4669
        list := self
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4670
                    selectItemIndicesFor:accessCharacterMatchQuery
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4671
                    maxDepth:maxShortCutSearchLevel from:1 to:index
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4672
                    ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ].
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4673
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4674
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4675
        list isNil ifTrue:[
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4676
            "/ must clear existing selection
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4677
            self selection:nil.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4678
            ^ nil
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4679
        ]
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4680
    ].
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4681
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4682
    "/ has item which responds to the mnemonic
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4683
    self processCollectedShortcutIndices:list.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4684
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4685
    "Modified: / 06-10-2011 / 16:25:21 / cg"
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4686
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4687
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4688
openMenusFromItemIndices:anItemIndiceList
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4689
    "open all menus derived from sequence of item indices"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4690
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4691
    |item|
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4692
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4693
    anItemIndiceList size == 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4694
	^ self
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4695
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4696
    item := self itemAt:(anItemIndiceList removeFirst).
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4697
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4698
    (item notNil and:[item enabled]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4699
	InitialSelectionQuerySignal answer:anItemIndiceList do:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4700
	    self selection:item openMenu:true.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4701
	]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4702
    ].
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4703
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4704
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4705
processCollectedShortcutIndices:indices
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4706
    |menu item|
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4707
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4708
    indices size == 0 ifTrue:[
4026
ed8b8c2f6c98 comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
  4709
        ^ self
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4710
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4711
    menu := self.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4712
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  4713
    "/ first lookup in current open submenus
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4714
    [menu selectionIndex == indices first] whileTrue:[
4026
ed8b8c2f6c98 comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
  4715
        (    (item := menu selection) isNil
ed8b8c2f6c98 comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
  4716
         or:[(menu := item currentSubmenu) isNil]
ed8b8c2f6c98 comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
  4717
        ) ifTrue:[ "/ selected but no submenu open - not handled
ed8b8c2f6c98 comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
  4718
            ^ self
ed8b8c2f6c98 comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
  4719
        ].
ed8b8c2f6c98 comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
  4720
        indices removeFirst.
ed8b8c2f6c98 comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
  4721
ed8b8c2f6c98 comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
  4722
        indices isEmpty ifTrue:[
ed8b8c2f6c98 comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
  4723
           menu selection:nil.
ed8b8c2f6c98 comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
  4724
            ^ self
ed8b8c2f6c98 comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
  4725
        ]
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4726
    ].
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4727
    menu openMenusFromItemIndices:indices.
4026
ed8b8c2f6c98 comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
  4728
ed8b8c2f6c98 comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
  4729
    "Modified: / 24-03-2011 / 11:19:38 / cg"
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4730
    "Created: / 06-10-2011 / 16:19:30 / cg"
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4731
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4732
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4733
processShortcut:aKeyEvent
2926
0d6dc899b49f ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents: 2919
diff changeset
  4734
    "a shortcutKey event as forwarded from the keyboardProcessor.
0d6dc899b49f ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents: 2919
diff changeset
  4735
     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
  4736
     Otherwise return false."
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4737
3431
ee7ea52cc2ad code refactored
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4738
    |menu rawKey logicalKey list item selectableItem|
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4739
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4740
    superMenu notNil ifTrue:[
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4741
        ^ superMenu processShortcut:aKeyEvent
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4742
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4743
    shown ifFalse:[^ false].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4744
3431
ee7ea52cc2ad code refactored
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4745
    logicalKey := aKeyEvent key.
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4746
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4747
    "/ fast check, cursor keys are not supported
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4748
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  4749
    ( #( CursorDown CursorUp CursorRight CursorLeft Return Escape
3431
ee7ea52cc2ad code refactored
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4750
       ) includes:logicalKey
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4751
    ) ifTrue:[
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4752
        ^ false.
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4753
    ].
3431
ee7ea52cc2ad code refactored
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4754
    rawKey := aKeyEvent rawKey.
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4755
    item := nil.
3328
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4756
    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
  4757
3394
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  4758
    "/ 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
  4759
    aKeyEvent isKeyReleaseEvent ifTrue:[
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4760
        selection isNil ifTrue:[
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4761
            prevFocusView := self windowGroup focusView.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4762
            self requestFocus. "/ self windowGroup focusView:self.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4763
            selectableItem := self firstItemSelectable.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4764
            self selection:selectableItem openMenu:false.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4765
        ] ifFalse:[
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4766
            prevFocusView requestFocus.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4767
            self selection:nil.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4768
        ].
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4769
        ^ true
3394
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  4770
    ].
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  4771
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4772
    [true] whileTrue:[
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4773
        list := menu
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4774
                    selectItemIndicesFor:[:el|
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4775
                        |skey|
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4776
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4777
                        item := el.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4778
                        el ignoreShortcutKeys ifTrue:[
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4779
                            false
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4780
                        ] ifFalse:[
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4781
                            skey := el shortcutKey.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4782
                            skey == rawKey or:[skey == logicalKey]
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4783
                        ]
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4784
                    ]
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4785
                    maxDepth:(self class maxShortCutSearchLevel) from:1 to:99999
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4786
                    ignoreSubmenuBlock:[:anItem | anItem ignoreShortcutKeys ].
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4787
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4788
        list size ~~ 0 ifTrue:[
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4789
            "/ has item which responds to the shortcut
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4790
            item hasSubmenu ifFalse:[
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4791
                menu accept:item
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4792
            ] ifTrue:[
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4793
                menu processCollectedShortcutIndices:list.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4794
                self requestFocus. "/ self windowGroup focusView:self.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4795
            ].
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4796
            ^ true
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4797
        ].
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4798
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4799
        menu == self ifTrue:[ ^ false ].
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4800
        menu := self.
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4801
    ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4802
    ^ false     "/ never reached
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4803
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4804
    "Modified: / 06-10-2011 / 16:19:27 / cg"
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4805
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4806
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4807
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
  4808
    "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
  4809
     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
  4810
     true. If no item is detected, nil is returned.
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4811
     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
  4812
     is created and passed through if the block returns false.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4813
     Otherwise the item is not asked for its submenu."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4814
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4815
    |start stop|
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4816
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4817
    maxDepth <= 0 ifTrue:[^ nil].
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4818
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4819
    start := aStart max:1.
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4820
    stop  := aStop  min:(items size).
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4821
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4822
    start to:stop do:[:i|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4823
	|item menu result|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4824
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4825
	item := items at:i.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4826
	(item enabled and:[item isVisible]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4827
	    (aOneArgBlock value:item) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4828
		^ OrderedCollection with:i
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4829
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4830
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4831
	    maxDepth > 1 ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4832
		(item hasSubmenu and:[item hasDelayedMenu not]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4833
		    (ignoreSubmenueBlock isNil or:[(ignoreSubmenueBlock value:item) not]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4834
			menu := item setupSubmenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4835
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4836
			(menu notNil and:[menu isEnabled]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4837
			    result := menu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4838
					selectItemIndicesFor:aOneArgBlock
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4839
					maxDepth:(maxDepth - 1) from:1 to:99999
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4840
					ignoreSubmenuBlock:ignoreSubmenueBlock.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4841
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4842
			    result notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4843
				result addFirst:i.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4844
				^ result
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4845
			    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4846
			].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4847
		    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4848
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4849
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4850
	].
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4851
    ].
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4852
    ^ nil
3128
9b92638bbd58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  4853
9b92638bbd58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  4854
    "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
  4855
! !
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4856
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4857
!MenuPanel methodsFor:'misc'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4858
427
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  4859
raiseDeiconified
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  4860
    ^ self raise
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  4861
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  4862
    "Created: 21.6.1997 / 13:29:12 / cg"
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  4863
!
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  4864
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4865
superMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4866
    "returns supermenu or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4867
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4868
    ^ superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4869
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4870
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4871
topMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4872
    "returns the topMenu; the one having no superMenu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4873
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4874
    |menu smenu|
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4875
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4876
    menu := self.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4877
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4878
    [(smenu := menu superMenu) notNil] whileTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4879
	menu := smenu
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4880
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4881
    ^ menu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4882
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4883
1825
962390f1b499 category change
Claus Gittinger <cg@exept.de>
parents: 1824
diff changeset
  4884
!MenuPanel methodsFor:'printing & storing'!
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4885
3360
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  4886
printOn:aStream
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  4887
    |label|
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  4888
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  4889
    aStream nextPutAll:'Menu:'.
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  4890
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  4891
    self do:[:eachItem|
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4892
	label  := eachItem label.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4893
	label notEmptyOrNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4894
	    aStream nextPutAll:'  '.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4895
	    label printOn:aStream.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4896
	].
3360
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  4897
    ].
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4898
! !
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4899
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4900
!MenuPanel methodsFor:'private'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4901
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  4902
application
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4903
    "optimize access to retrive the application"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4904
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4905
    application notNil ifTrue:[^ application ].
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  4906
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  4907
    superMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4908
	application := superMenu application.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4909
	^ application
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4910
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4911
    application := super application.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4912
    ^ application
1872
b20e27632fd8 application fetch fix
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  4913
!
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  4914
3725
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  4915
detectItem:aBlock
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  4916
    "returns the item for which aBlock returns true."
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  4917
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  4918
    items notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4919
	items keysAndValuesDo:[:anIndex :anItem|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4920
	    (aBlock value:anItem) ifTrue:[^ anItem].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4921
	].
3725
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  4922
    ].
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  4923
    ^ nil
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  4924
!
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  4925
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4926
detectItemForKey:aKey
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4927
    "returns the item assigned to a key, accessCharacter or starts with.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4928
     if no item is detected nil is returned."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4929
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4930
    |cIdx uKey lKey item|
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4931
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4932
    items isNil ifTrue:[^ nil].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4933
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4934
    cIdx := self selectionIndex.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4935
    uKey := aKey asUppercase.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4936
    lKey := aKey asLowercase.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4937
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4938
    items keysAndValuesDo:[:anIndex :anItem|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4939
	|char label|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4940
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4941
	(     anIndex ~~ cIdx
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4942
	 and:[anItem canSelect
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4943
	 and:[(label := anItem textLabel) notNil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4944
	 and:[label size ~~ 0]]]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4945
	) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4946
	    (char := anItem accessCharacter) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4947
		(char == uKey or:[char == lKey]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4948
		    ^ anItem
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4949
		]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4950
	    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4951
		char := label at:1.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4952
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4953
		(char == uKey or:[char == lKey]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4954
		    anIndex > cIdx ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4955
			^ anItem
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4956
		    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4957
		    item isNil ifTrue:[item := anItem]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4958
		]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4959
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4960
	]
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4961
    ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4962
    ^ item
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4963
!
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4964
3725
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  4965
detectItemForLabel:aLabel
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  4966
    ^ self detectItem:[:anItem | anItem label = aLabel].
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  4967
!
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  4968
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  4969
detectItemForNameKey:aKey
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  4970
    ^ self detectItem:[:anItem | anItem nameKey == aKey].
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  4971
!
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  4972
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4973
onEachPerform:aSelector withArgList:aList
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4974
    "on each item perform selector with an argument derived from aList"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4975
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4976
    aList isCollection ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4977
	items size >= aList size ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4978
	    aList keysAndValuesDo:[:anIndex :anArg|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4979
		(items at:anIndex) perform:aSelector with:anArg
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4980
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4981
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4982
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4983
	self do:[:anItem| anItem perform:aSelector with:aList ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4984
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4985
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4986
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4987
registerImageOnDevice:anImage
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4988
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4989
    anImage isNil ifTrue:[ ^ nil ].
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4990
  ^ self class image:anImage onDevice:device
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4991
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4992
"/    |image|
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4993
"/
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4994
"/    (image := anImage) notNil ifTrue:[
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4995
"/        image device ~~ device ifTrue:[
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4996
"/            image := image copy.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4997
"/        ].
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4998
"/        image := image onDevice:device.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4999
"/        image := image clearMaskedPixels.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5000
"/    ].
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5001
"/    ^ image
2355
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  5002
!
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  5003
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  5004
superMenu:aSuperMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5005
    "set my supermenu from which i'am activated"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5006
2355
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  5007
    superMenu := aSuperMenu.
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  5008
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5009
    superMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5010
	styleSheet       := superMenu styleSheet.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5011
	rightArrow       := superMenu rightArrow.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5012
	rightArrowShadow := superMenu rightArrowShadow.
2355
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  5013
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5014
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5015
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5016
!MenuPanel methodsFor:'private-activation'!
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5017
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5018
activeMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5019
    "returns the current active menu or self (the top menu)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5020
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5021
    ^ lastActiveMenu ? self
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5022
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5023
    "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
  5024
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5025
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5026
activeMenu:aMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5027
    "set the current active menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5028
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5029
    lastActiveMenu := aMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5030
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5031
    "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
  5032
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5033
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5034
becomesActiveMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5035
    "submenu becomes the active menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5036
3224
96aba140912d bugfix for mapTime
ca
parents: 3222
diff changeset
  5037
    mapTime isNil ifTrue:[
4122
50b3429eb6b4 Use Timestamo instead of AbsoluteTime
Stefan Vogel <sv@exept.de>
parents: 4119
diff changeset
  5038
        "/ set the mapTime if not yet done
50b3429eb6b4 Use Timestamo instead of AbsoluteTime
Stefan Vogel <sv@exept.de>
parents: 4119
diff changeset
  5039
        mapTime := Timestamp now.
3224
96aba140912d bugfix for mapTime
ca
parents: 3222
diff changeset
  5040
    ].
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5041
    self topMenu activeMenu:self.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5042
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5043
    "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
  5044
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5045
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5046
clearLastActiveMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5047
    "reset the current active menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5048
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5049
    |top|
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5050
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5051
    top := self topMenu.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5052
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5053
"/    prevFocusView notNil ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5054
"/        self windowGroup focusView:prevFocusView.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5055
"/        prevFocusView := nil.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5056
"/    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5057
"/
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5058
    top activeMenu == self ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5059
	top activeMenu:nil
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5060
    ]
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5061
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5062
    "Created: / 27.2.1998 / 17:41:17 / cg"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5063
!
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5064
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5065
mapTime
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5066
    "get the time the menu was activated or nil"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5067
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5068
    ^ mapTime
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5069
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5070
    "Modified: / 27.2.1998 / 17:41:18 / cg"
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5071
!
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5072
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5073
mapTime:aTimestamp
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5074
    "set the time the menu was activated"
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5075
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5076
    mapTime := aTimestamp.
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5077
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5078
    "Modified: / 27.2.1998 / 17:41:18 / cg"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5079
! !
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5080
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5081
!MenuPanel methodsFor:'private-scrolling'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5082
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5083
hasScrollerAt:aDirection
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5084
    "returns true if a visible scroller at a direction exists"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5085
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5086
    |layout|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5087
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5088
    self hasScrollers ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5089
	^ false
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5090
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5091
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5092
    aDirection == #PREV ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5093
	layout := items first layout.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5094
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5095
      ^ self verticalLayout ifTrue:[ layout top  < margin]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5096
			   ifFalse:[ layout left < margin]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5097
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5098
    layout := items last layout.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5099
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5100
  ^ self verticalLayout ifTrue:[ layout bottom > (height - margin)]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5101
		       ifFalse:[ layout right  > (width  - margin)]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5102
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5103
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5104
hasScrollers
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5105
    "returns true if scrollers are needed"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5106
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5107
    |maxExtent first last isVert|
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5108
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  5109
    (mustRearrange or:[items size <= 1]) ifTrue:[^ false].
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5110
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5111
    isVert := self verticalLayout.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5112
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5113
    superView notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5114
	((first := items first layout) isNil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5115
	 or:[(last  := items last layout) isNil]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5116
	) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5117
	    ^ false
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5118
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5119
	isVert ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5120
	    ^ first top < 0 or:[last bottom > height]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5121
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5122
	^ first left < 0 or:[last right > width]
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5123
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5124
    maxExtent := self maxExtent.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5125
    isVert ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5126
	^ (height >= maxExtent y)
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  5127
    ].
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  5128
    ^ (width >= maxExtent x)
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5129
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5130
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5131
indexOfItemAtScroller:aDirection
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5132
    "returns the index of the item under the scroller or 0"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5133
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5134
    |bounds min max layout|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5135
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  5136
    self hasScrollers ifFalse:[ ^ 0 ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5137
    bounds := self scrollerBoundsAt:aDirection.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5138
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5139
    self verticalLayout ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5140
	min := bounds top.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5141
	max := bounds bottom.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5142
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5143
	items keysAndValuesDo:[:anIndex :anItem|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5144
	    anItem isVisible ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5145
		layout := anItem layout.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5146
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5147
		(layout top < max and:[layout bottom > min]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5148
		    ^ anIndex
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5149
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5150
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5151
	].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5152
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5153
	min := bounds left.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5154
	max := bounds right.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5155
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5156
	items keysAndValuesDo:[:anIndex :anItem|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5157
	    anItem isVisible ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5158
		layout := anItem layout.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5159
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5160
		(layout left < max and:[layout right > min]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5161
		    ^ anIndex
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5162
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5163
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5164
	]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5165
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5166
    ^ 0
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5167
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5168
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5169
makeItemVisible:anItem
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5170
    "make an item visible"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5171
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5172
    |boundsPREV boundsNEXT delta layout index scr0 scr1 windowSz scrSz doScroll
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5173
     isVertical boundsMin layoutMin boundsMax layoutMax dltOrg
2042
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  5174
     inv1 inv2|
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5175
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5176
    (     anItem notNil
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5177
     and:[self hasScrollers
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5178
     and:[(layout := anItem layout) notNil]]
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5179
    ) ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5180
	^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5181
    ].
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5182
    index      := self indexOfItem:anItem.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5183
    boundsPREV := self scrollerBoundsAt:#PREV.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5184
    boundsNEXT := self scrollerBoundsAt:#NEXT.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5185
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5186
    isVertical := self verticalLayout.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5187
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5188
    isVertical ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5189
	boundsMin := boundsPREV bottom.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5190
	boundsMax := boundsNEXT top.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5191
	layoutMin := layout top.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5192
	layoutMax := layout bottom.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5193
	windowSz  := height.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5194
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5195
	boundsMin := boundsPREV right.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5196
	boundsMax := boundsNEXT left.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5197
	layoutMin := layout left.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5198
	layoutMax := layout right.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5199
	windowSz  := width.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5200
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5201
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5202
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5203
    layoutMin < boundsMin ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5204
	layoutMin >= 0 ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5205
	    ^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5206
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5207
	"/ test whether is first visible item
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5208
	index := items findLast:[:el| el isVisible] startingAt:(index - 1).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5209
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5210
	index == 0 ifTrue:[ scr0 := margin ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5211
		  ifFalse:[ scr0 := boundsMin ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5212
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5213
	delta := layoutMin negated + scr0.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5214
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5215
	layoutMax > boundsMax ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5216
	    ^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5217
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5218
	"/ test whether is last visible item
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5219
	index  := items findFirst:[:el| el isVisible ] startingAt:(index + 1).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5220
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5221
	index == 0 ifTrue:[ scr0 := windowSz - margin ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5222
		  ifFalse:[ scr0 := boundsMax ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5223
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5224
	delta := scr0 - layoutMax.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5225
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5226
    delta == 0 ifTrue:[ ^ self ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5227
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5228
    doScroll := false.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5229
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5230
    shown ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5231
	delta abs < (windowSz / 2) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5232
	    doScroll := true.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5233
	    self repairDamage
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5234
	]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5235
    ].
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5236
    isVertical ifTrue:[ dltOrg := 0@delta ] ifFalse:[dltOrg := delta@0].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5237
    items do:[:el| el moveBy:dltOrg ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5238
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5239
    doScroll ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5240
	self invalidate.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5241
	^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5242
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5243
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5244
    windowSz  := windowSz - margin - margin.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5245
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5246
    scr0  := boundsMin.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5247
    scr1  := scr0 + delta abs.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5248
    scrSz := boundsMax - scr1.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5249
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5250
    delta < 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5251
	isVertical ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5252
	    self copyFrom:self x:margin y:scr1 toX:margin y:scr0
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5253
			   width:windowSz height:scrSz async:false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5254
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5255
	    scr1 := scr0 + scrSz.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5256
	    inv2 := (margin @ scr1) extent:(windowSz @ (height - scr1 - margin)).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5257
	    "/ self invalidateX:margin y:scr1 width:windowSz height:(height - scr1 - margin).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5258
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5259
	    self copyFrom:self x:scr1 y:margin toX:scr0 y:margin
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5260
			   width:scrSz height:windowSz async:false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5261
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5262
	    scr1 := scr0 + scrSz.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5263
	    inv2 := (scr1 @ margin) extent:((width - scr1 - margin) @ windowSz).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5264
	    "/ self invalidateX:scr1 y:margin width:(width - scr1 - margin) height:windowSz.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5265
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5266
	inv1 := boundsPREV.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5267
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5268
	isVertical ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5269
	    self copyFrom:self x:margin y:scr0 toX:margin y:scr1
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5270
			   width:windowSz height:scrSz async:false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5271
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5272
	    inv2 := (margin @ margin) extent:(windowSz @ (scr1 - margin)).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5273
	    "/ self invalidateX:margin y:margin width:windowSz height:scr1 - margin.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5274
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5275
	    self copyFrom:self x:scr0 y:margin toX:scr1 y:margin
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5276
			   width:scrSz height:windowSz async:false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5277
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5278
	    inv2 := (margin @ margin) extent:(scr1 - margin) @ windowSz.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5279
	    "/ self invalidateX:margin y:margin width:scr1 - margin height:windowSz.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5280
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5281
	inv1 := boundsNEXT.
2042
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  5282
    ].
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  5283
    self invalidate:inv1.
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  5284
    self invalidate:inv2.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  5285
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  5286
    "Modified: / 13.11.2001 / 20:26:42 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5287
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5288
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5289
scrollActivity
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5290
    "returns the one and only scrollActivity - data holder
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5291
     for a menu and all contained submenus"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5292
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5293
    superMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5294
	^ superMenu scrollActivity
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5295
    ].
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5296
    scrollActivity isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5297
	scrollActivity := ScrollActivity new.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5298
    ].
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5299
    ^ scrollActivity
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5300
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5301
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5302
scrollerBoundsAt:aDirection
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  5303
    "returns the bounds of the scroller at a direction"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5304
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5305
    |y x w h inset|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5306
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5307
    inset := 0.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5308
    x := y := inset.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5309
    w := h := 15.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5310
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5311
    self verticalLayout ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5312
	aDirection == #NEXT ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5313
	    y := height - h - inset.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5314
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5315
	w := width - inset - inset.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5316
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5317
	aDirection == #NEXT ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5318
	    x := width - w - inset.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5319
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5320
	h := height - inset - inset.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5321
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5322
    ^ Rectangle left:x top:y width:w height:h
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5323
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5324
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5325
scrollerDirectionAtPoint:aPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5326
    "returns the scroller-direction at aPoint, or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5327
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5328
    self hasScrollers ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5329
	#( PREV NEXT ) do:[:aDirection| |bounds|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5330
	    bounds := self scrollerBoundsAt:aDirection.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5331
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5332
	    (bounds containsPoint:aPoint) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5333
		^ (self hasScrollerAt:aDirection) ifTrue:[aDirection] ifFalse:[nil]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5334
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5335
	]
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5336
    ].
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5337
    ^ nil
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5338
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5339
    "Created: / 13.11.2001 / 14:13:16 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5340
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5341
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5342
!MenuPanel methodsFor:'private-searching'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5343
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5344
detectGrabMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5345
    "returns the menu which is responsible for the grap; the last opened menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5346
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5347
    |subMenu|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5348
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5349
    selection notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5350
	(subMenu := selection visibleSubmenu) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5351
	    ^ subMenu detectGrabMenu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5352
	]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5353
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5354
    ^ self
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5355
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5356
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5357
detectMenuAtGrabPoint:aGrabPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5358
    "returns the menu which contains the grab-point"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5359
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5360
    |dstMenu dstPoint firstMenu|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5361
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5362
    dstPoint := self translateGrabPoint:aGrabPoint.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5363
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5364
    ((dstPoint x between:0 and:width) and:[dstPoint y between:0 and:height]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5365
	firstMenu := self.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5366
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5367
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5368
    (selection isNil or:[(dstMenu := selection visibleSubmenu) isNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5369
	^ firstMenu
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5370
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5371
    dstMenu := dstMenu detectMenuAtGrabPoint:aGrabPoint.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  5372
    ^ dstMenu ? firstMenu
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5373
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5374
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5375
detectViewAtX:x y:y in:aTopView
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5376
    "detect view at x@y"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5377
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5378
    ^ aTopView detectViewAt:(x@y).
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5379
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5380
"/ 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
  5381
"/
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5382
"/    |p subViews|
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5383
"/
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5384
"/    (subViews := aTopView subViews) notNil ifTrue:[
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5385
"/        subViews do:[:v| |p|
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5386
"/            v shown ifTrue:[
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5387
"/                (    (x between:(v left) and:(v right))
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5388
"/                 and:[y between:(v top)  and:(v bottom)]
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5389
"/                ) ifTrue:[
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5390
"/                    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
  5391
"/                  ^ 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
  5392
"/                ]
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5393
"/            ]
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5394
"/        ]
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
"/    ^ aTopView
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5397
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5398
    "Modified: / 10.10.2001 / 13:45:56 / cg"
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5399
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5400
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5401
itemAt:stringOrNumberOrPoint
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5402
    "returns item assigned to an index, nameKey, textLabel or value if symbol.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5403
     If no item match nil is returned."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5404
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5405
    |idx|
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5406
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5407
    stringOrNumberOrPoint isPoint ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5408
	^ self itemAtPoint:stringOrNumberOrPoint
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5409
    ].
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5410
    idx := self indexOf:stringOrNumberOrPoint.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5411
    (idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ].
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5412
    ^ nil
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5413
!
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5414
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5415
itemAtPoint:aPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5416
    "returns the item at aPoint or nil if none detected"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5417
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5418
    |x y|
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5419
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5420
    items notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5421
	x := aPoint x.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5422
	y := aPoint y.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5423
	^ items detect:[:el| el containsPointX:x y:y] ifNone:nil
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5424
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5425
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5426
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5427
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  5428
superMenuAtPoint:aPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5429
    "returns the superMenu which contains aPoint, or nil if none detected"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5430
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5431
    |grabPoint superMenu|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5432
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  5433
    (self containsPoint:aPoint) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5434
	^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5435
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5436
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  5437
    grabPoint := aPoint - (self translateGrabPoint:0).
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5438
    superMenu := self.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5439
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5440
    [ (superMenu := superMenu superMenu) notNil ] whileTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5441
	(superMenu containsPoint:(superMenu translateGrabPoint:grabPoint)) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5442
	    ^ superMenu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5443
	]
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5444
    ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5445
    ^ nil
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5446
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  5447
    "Created: / 13.11.2001 / 20:22:53 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5448
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5449
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5450
!MenuPanel methodsFor:'queries'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5451
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5452
container:aView
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5453
    super container:aView.
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5454
    aView notNil ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  5455
	"/ I am no longer a popUpView
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  5456
	self updateLevelAndBorder
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5457
    ].
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5458
!
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5459
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5460
containsPoint:aPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5461
    "returns true if the argument, aPoint is contained by the view"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5462
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5463
    ^ self containsPointX:(aPoint x) y:(aPoint y)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5464
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5465
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5466
containsPointX:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5467
    "returns true if point is contained by the view"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5468
708
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  5469
    ^ (x between:0 and:width) and:[y between:0 and:height]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5470
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5471
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5472
hasGroupDividerAt:anIndex
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5473
    "returns true if a divider is defined at an index"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5474
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5475
    |i|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5476
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5477
    groupSizes size ~~ 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5478
	i := 0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5479
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5480
	groupSizes do:[:t|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5481
	    (i := i + t) == anIndex ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5482
		^ true
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5483
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5484
	]
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5485
    ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5486
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5487
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5488
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5489
hasGroupDividers
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5490
    "returns true if any group divider exists"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5491
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5492
    ^ (items size ~~ 0 and:[groupSizes size ~~ 0])
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5493
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5494
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  5495
hasPerformed
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  5496
    ^ hasPerformed ? false
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  5497
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  5498
    "Created: / 29-06-2011 / 16:24:14 / cg"
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  5499
!
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  5500
3457
6f19c84f9ff8 Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents: 3454
diff changeset
  5501
isActive
6f19c84f9ff8 Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents: 3454
diff changeset
  5502
    "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
  5503
     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
  5504
     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
  5505
     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
  5506
6f19c84f9ff8 Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents: 3454
diff changeset
  5507
     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
  5508
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5509
    ^ windowGroup notNil and:[windowGroup anyViewHasFocus]
3457
6f19c84f9ff8 Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents: 3454
diff changeset
  5510
!
6f19c84f9ff8 Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents: 3454
diff changeset
  5511
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5512
isFitPanel
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5513
    "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
  5514
     be fit to the extent of its superView;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5515
     NOT SUPPORTED"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5516
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5517
    ^ false
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5518
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5519
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5520
isPopUpView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5521
    "return true if view is a popup view; without decoration
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5522
     and popUp to top immediately"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5523
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5524
    ^ superView isNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5525
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5526
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5527
isVerticalLayout
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5528
    "returns true if vertical layout otherwise false( horizontal layout )"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5529
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5530
    ^ self verticalLayout
416
c05874084d4c implement
ca
parents: 407
diff changeset
  5531
!
c05874084d4c implement
ca
parents: 407
diff changeset
  5532
1793
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  5533
isViewWrapper
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  5534
    ^ items size == 0 and:[subViews size ~~ 0]
1793
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  5535
!
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  5536
416
c05874084d4c implement
ca
parents: 407
diff changeset
  5537
type
428
ca
parents: 427
diff changeset
  5538
    ^ nil.
416
c05874084d4c implement
ca
parents: 407
diff changeset
  5539
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5540
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5541
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5542
!MenuPanel methodsFor:'selection'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5543
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5544
hasSelection
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5545
    "returns true if a selection exists"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5546
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5547
    ^ self selection notNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5548
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5549
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5550
openDelayed:anItem
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  5551
    self openDelayed:anItem afterSeconds:0.5.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  5552
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  5553
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  5554
openDelayed:anItem afterSeconds:seconds
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5555
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5556
    superMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5557
	superMenu openDelayed:anItem afterSeconds:seconds.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5558
	^ self
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5559
    ].
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5560
    openDelayedMenuBlock notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5561
	Processor removeTimedBlock:openDelayedMenuBlock.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5562
	openDelayedMenuBlock := nil.
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  5563
    ].
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  5564
    (anItem notNil and:[anItem hasSubmenu]) ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5565
	openDelayedMenuBlock := nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5566
	^ self
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  5567
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  5568
    openDelayedMenuBlock := [
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5569
	openDelayedMenuBlock := nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5570
	anItem openDelayedSubmenu
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  5571
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  5572
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  5573
    Processor addTimedBlock:openDelayedMenuBlock afterSeconds:seconds.
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5574
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5575
3975
ca
parents: 3966
diff changeset
  5576
selectAndOpenDelayed:anItemOrNil
ca
parents: 3966
diff changeset
  5577
    "change selection to an item or nil"
ca
parents: 3966
diff changeset
  5578
ca
parents: 3966
diff changeset
  5579
    |helpListener oldSelect delayedOpenSeconds|
ca
parents: 3966
diff changeset
  5580
ca
parents: 3966
diff changeset
  5581
    delayedOpenSeconds := self delayInSecondsBeforeOpeningSubmenu.
ca
parents: 3966
diff changeset
  5582
ca
parents: 3966
diff changeset
  5583
    anItemOrNil == selection ifTrue:[ ^ self ].
ca
parents: 3966
diff changeset
  5584
    self openDelayed:nil.
ca
parents: 3966
diff changeset
  5585
ca
parents: 3966
diff changeset
  5586
    oldSelect := selection.
ca
parents: 3966
diff changeset
  5587
    selection := nil.
ca
parents: 3966
diff changeset
  5588
    delayedOpenSeconds := self delayInSecondsBeforeOpeningSubmenu.
ca
parents: 3966
diff changeset
  5589
ca
parents: 3966
diff changeset
  5590
    oldSelect notNil ifTrue:[
ca
parents: 3966
diff changeset
  5591
        "/ clear current selection
ca
parents: 3966
diff changeset
  5592
        |oldSubmenu|
ca
parents: 3966
diff changeset
  5593
        oldSubmenu := oldSelect visibleSubmenu.
ca
parents: 3966
diff changeset
  5594
ca
parents: 3966
diff changeset
  5595
        oldSubmenu notNil ifTrue:[
ca
parents: 3966
diff changeset
  5596
            Processor addTimedBlock:[
ca
parents: 3966
diff changeset
  5597
                selection ~~ oldSelect ifTrue:[
ca
parents: 3966
diff changeset
  5598
                    "cancels the current delayed opertion"
ca
parents: 3966
diff changeset
  5599
                    oldSelect hideSubmenu.
ca
parents: 3966
diff changeset
  5600
ca
parents: 3966
diff changeset
  5601
                    ( selection notNil
ca
parents: 3966
diff changeset
  5602
                    and:[selection hasSubmenu
ca
parents: 3966
diff changeset
  5603
                    and:[selection visibleSubmenu isNil]]
ca
parents: 3966
diff changeset
  5604
                    ) ifTrue:[
ca
parents: 3966
diff changeset
  5605
                        "setup new delayed opertion.."
ca
parents: 3966
diff changeset
  5606
                        self openDelayed:selection afterSeconds:0.1
ca
parents: 3966
diff changeset
  5607
                    ].
ca
parents: 3966
diff changeset
  5608
                ].
ca
parents: 3966
diff changeset
  5609
            ] afterSeconds:delayedOpenSeconds.
ca
parents: 3966
diff changeset
  5610
        ].
ca
parents: 3966
diff changeset
  5611
        oldSelect invalidate.
ca
parents: 3966
diff changeset
  5612
    ].
ca
parents: 3966
diff changeset
  5613
ca
parents: 3966
diff changeset
  5614
    anItemOrNil notNil ifTrue:[
ca
parents: 3966
diff changeset
  5615
        self makeItemVisible:anItemOrNil.
ca
parents: 3966
diff changeset
  5616
        anItemOrNil canSelect ifTrue:[
ca
parents: 3966
diff changeset
  5617
            selection := anItemOrNil
ca
parents: 3966
diff changeset
  5618
        ].
ca
parents: 3966
diff changeset
  5619
    ].
ca
parents: 3966
diff changeset
  5620
    selection isNil ifTrue:[^ self].
ca
parents: 3966
diff changeset
  5621
ca
parents: 3966
diff changeset
  5622
    ActiveHelp isActive ifTrue:[
ca
parents: 3966
diff changeset
  5623
        helpListener := ActiveHelp currentHelpListener.
ca
parents: 3966
diff changeset
  5624
        helpListener initiateHelpFor:self at:nil now:true.
ca
parents: 3966
diff changeset
  5625
    ].
ca
parents: 3966
diff changeset
  5626
    shown ifTrue:[
ca
parents: 3966
diff changeset
  5627
        "/ self rearrangeItems.
ca
parents: 3966
diff changeset
  5628
        selection invalidate.
ca
parents: 3966
diff changeset
  5629
ca
parents: 3966
diff changeset
  5630
        selection hasSubmenu ifTrue:[
ca
parents: 3966
diff changeset
  5631
            self openDelayed:selection afterSeconds:delayedOpenSeconds.
ca
parents: 3966
diff changeset
  5632
        ].
ca
parents: 3966
diff changeset
  5633
    ].
ca
parents: 3966
diff changeset
  5634
!
ca
parents: 3966
diff changeset
  5635
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5636
selection
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5637
    "returns current selected item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5638
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5639
    ^ selection
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5640
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5641
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5642
selection:anItemOrNil
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5643
    "change selection to an item or nil
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5644
     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
  5645
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5646
    |openMenu openOnSelect submenu item|
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5647
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5648
    selection == anItemOrNil ifTrue:[^ self].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5649
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5650
    (anItemOrNil isNil or:[anItemOrNil hasSubmenu not]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5651
	self selection:anItemOrNil openMenu:false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5652
	^ self
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5653
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5654
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5655
    openMenu     := self isPopUpView not.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5656
    openOnSelect := styleSheet at:#'menu.openOnSelect' default:false.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5657
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5658
    openMenu ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5659
	openMenu := openOnSelect.
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5660
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5661
    self selection:anItemOrNil openMenu:openMenu.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5662
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5663
    openOnSelect ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5664
	"/ select first item in submenu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5665
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5666
	submenu := anItemOrNil currentSubmenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5667
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5668
	submenu notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5669
	    item := submenu itemAt:1.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5670
	    (item notNil and:[item hasSubmenu not]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5671
		submenu selection:item openMenu:false
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5672
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5673
	].
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5674
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5675
!
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5676
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5677
selection:anItemOrNil openMenu:openMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5678
    "change selection to an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5679
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5680
    |helpListener oldSelect|
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5681
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5682
    anItemOrNil == selection ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5683
	^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5684
    ].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5685
    self openDelayed:nil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5686
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5687
    oldSelect := selection.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5688
    selection := nil.
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5689
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5690
    anItemOrNil notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5691
	self makeItemVisible:anItemOrNil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5692
	anItemOrNil canSelect ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5693
	    selection := anItemOrNil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5694
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5695
	    oldSelect isNil ifTrue:[^ self].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5696
	].
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5697
    ].
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5698
    oldSelect notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5699
	"/ clear current selection
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5700
	oldSelect isSelected:false.
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5701
    ].
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5702
    selection isNil ifTrue:[^ self].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5703
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  5704
"/    selection == enteredItem ifTrue:[
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  5705
"/        enteredItem := nil
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  5706
"/    ] ifFalse:[
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  5707
"/        self pointerEntersItem:nil
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  5708
"/    ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5709
    ActiveHelp isActive ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5710
	helpListener := ActiveHelp currentHelpListener.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5711
	helpListener initiateHelpFor:self at:nil now:true.
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5712
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5713
    shown ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5714
	"/ self rearrangeItems.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5715
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5716
	openMenu ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5717
	    selection invalidate.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5718
	]
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5719
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5720
    openMenu ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5721
	selection isSelected:true.
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5722
    ].
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
selectionIndex
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5726
    "returns index of current selection or 0"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5727
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5728
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5729
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5730
    (item := self selection) notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5731
	^ self findFirst:[:el| el == item ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5732
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5733
    ^ 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5734
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5735
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5736
selectionIndex:anIndex
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5737
    "set selection at an index"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5738
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5739
    self selection:(self itemAt:anIndex)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5740
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5741
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5742
!MenuPanel methodsFor:'translation'!
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5743
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5744
translateGrabPoint:aGrabPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5745
    "translate the grab point into self"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5746
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5747
    superMenu isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5748
	"I am the grabView"
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5749
	aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5750
	^ aGrabPoint
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5751
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5752
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5753
    relativeGrabOrigin isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5754
	relativeGrabOrigin := self topMenu translatePoint:0 to:self.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5755
	relativeGrabOrigin isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5756
	    "I am the grabView"
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5757
	    aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5758
	    ^ aGrabPoint
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5759
	].
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5760
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5761
    ^ relativeGrabOrigin + aGrabPoint
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5762
!
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5763
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5764
translateMenuPoint:aPoint toMenu:aMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5765
    "translate a point into another menu its point"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5766
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5767
    |grapPoint|
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5768
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5769
    aMenu == self ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5770
	^ aPoint
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5771
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5772
    grapPoint := aPoint - (self translateGrabPoint:0).
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5773
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5774
    ^ aMenu translateGrabPoint:grapPoint
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5775
!
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5776
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5777
translatePoint:aPoint to:anotherWindowOrNilForScreen
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5778
    "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
  5779
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5780
    ^ device
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5781
	translatePoint:aPoint asPoint
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5782
	fromView:self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5783
	toView:anotherWindowOrNilForScreen
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5784
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5785
    "Modified: / 10.10.2001 / 14:11:47 / cg"
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5786
! !
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5787
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5788
!MenuPanel::Item class methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5789
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  5790
horizontalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  5791
    ^ HorizontalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  5792
!
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  5793
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5794
labelRightOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5795
    ^ LabelRightOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5796
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5797
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  5798
verticalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  5799
    ^ VerticalInset
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  5800
!
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  5801
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  5802
verticalPopUpInset
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  5803
    ^ VerticalPopUpInset
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5804
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5805
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  5806
!MenuPanel::Item class methodsFor:'defaults'!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  5807
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5808
halfSeparatorSize
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5809
    "returns the size of a space-separator"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5810
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5811
    ^ 5
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5812
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5813
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5814
separatorSize
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5815
    "returns the size of a separator"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5816
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5817
    ^ 10
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  5818
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  5819
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  5820
updateStyleCache
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  5821
    "extract values from the styleSheet and cache them in class variables"
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  5822
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  5823
    <resource: #style (#'menuPanel.verticalInset')>
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  5824
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5825
    HorizontalInset       := 2.
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  5826
    VerticalInset         := MenuPanel styleSheet at:#'menuPanel.verticalInset' default:2.
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  5827
    VerticalPopUpInset    := 2.
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  5828
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  5829
    HorizontalButtonInset := 3.
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  5830
    VerticalButtonInset   := 3.
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  5831
681
62c7cdaca188 extra default inset values for button behaviour added
tz
parents: 680
diff changeset
  5832
    LabelRightOffset      := 15.
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  5833
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  5834
    "
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  5835
     self updateStyleCache
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  5836
    "
1124
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  5837
! !
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  5838
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5839
!MenuPanel::Item class methodsFor:'instance creation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5840
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5841
in:aSuperMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5842
    ^ self in:aSuperMenu label:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5843
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5844
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5845
in:aSuperMenu label:aLabel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5846
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5847
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5848
    item := self new in:aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5849
    item label:aLabel.
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5850
    ^ item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5851
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5852
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5853
in:aSuperMenu menuItem:aMenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5854
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5855
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5856
    item := self in:aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5857
    item menuItem:aMenuItem.
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5858
    ^ item.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5859
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5860
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5861
new
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5862
    ^ self basicNew initialize
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5863
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5864
1808
e8628b502a49 methodCategory change
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
  5865
!MenuPanel::Item methodsFor:'accepting'!
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5866
420
ca
parents: 417
diff changeset
  5867
canAccept
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5868
    "returns true if item is acceptable"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5869
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5870
    self enabled    ifFalse:[ ^ false].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5871
    self hasSubmenu ifFalse:[ ^ true ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5872
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5873
    self hasDelayedMenu ifFalse:[^ false ].
3558
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
  5874
    ^ subMenu isNil or:[subMenu shown not]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5875
!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5876
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5877
toggleIndication
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5878
    "toggle indication or choice"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5879
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5880
    |arg|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5881
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5882
    indication notNil ifTrue:[
4118
a2a352a255a9 Fix behavior, if a menu item's choice is a block
Stefan Vogel <sv@exept.de>
parents: 4113
diff changeset
  5883
        arg := self indicationValue not.
a2a352a255a9 Fix behavior, if a menu item's choice is a block
Stefan Vogel <sv@exept.de>
parents: 4113
diff changeset
  5884
        self indicationValue:arg.
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5885
    ] ifFalse:[
4118
a2a352a255a9 Fix behavior, if a menu item's choice is a block
Stefan Vogel <sv@exept.de>
parents: 4113
diff changeset
  5886
        (choice notNil and:[choice isValueModel])ifTrue:[
a2a352a255a9 Fix behavior, if a menu item's choice is a block
Stefan Vogel <sv@exept.de>
parents: 4113
diff changeset
  5887
            choice value:(menuItem choiceValue).
a2a352a255a9 Fix behavior, if a menu item's choice is a block
Stefan Vogel <sv@exept.de>
parents: 4113
diff changeset
  5888
            ^ true
a2a352a255a9 Fix behavior, if a menu item's choice is a block
Stefan Vogel <sv@exept.de>
parents: 4113
diff changeset
  5889
        ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5890
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5891
    ^ arg
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5892
! !
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5893
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5894
!MenuPanel::Item methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5895
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5896
accessCharacter
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5897
    "returns my accessCharacter or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5898
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5899
    ^ accessCharacter
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5900
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5901
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5902
accessCharacterPosition
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5903
    "get the access character position or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5904
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5905
    ^ menuItem accessCharacterPosition
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5906
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5907
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5908
accessCharacterPosition:anIndex
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5909
    "set the access character position or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5910
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5911
    menuItem accessCharacterPosition:anIndex.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5912
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5913
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5914
argument
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5915
    "gets the argument"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5916
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5917
    ^ menuItem argument
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5918
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5919
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5920
argument:anArgument
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5921
    "sets the argument"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5922
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5923
    menuItem argument:anArgument.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5924
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5925
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5926
displayLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5927
    "returns my printable Label"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5928
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5929
    ^ displayLabel
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5930
!
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5931
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5932
displayLabelExtent
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5933
    "returns the labels extent"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5934
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  5935
    |myFont prevFont w h|
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5936
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5937
    displayLabelExtent notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5938
	^ displayLabelExtent
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5939
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5940
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5941
    displayLabel isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5942
	displayLabelExtent := 0@0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5943
	^ displayLabelExtent
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5944
    ].
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  5945
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  5946
    myFont := self font.
3928
d175aca884ce fixed a font bug: used current font for extent computation,
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
  5947
    myFont isNil ifTrue:[ self font:(myFont := menuPanel font) ].
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  5948
    myFont := myFont onDevice:menuPanel device.
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  5949
3845
81fa525dcfa7 fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents: 3837
diff changeset
  5950
    prevFont := menuPanel setFont:myFont.
81fa525dcfa7 fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents: 3837
diff changeset
  5951
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  5952
    displayLabel isString ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5953
	w := displayLabel widthOn:menuPanel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5954
	h := displayLabel heightOn:menuPanel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5955
"/        w := myFont widthOf:displayLabel.
3845
81fa525dcfa7 fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents: 3837
diff changeset
  5956
"/        h := myFont heightOf:displayLabel.
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5957
    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5958
	displayLabel isArray ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5959
	    w := h := 0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5960
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5961
	    displayLabel do:[:aSubLabel|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5962
		aSubLabel notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5963
		    w := w max:(aSubLabel widthOn:menuPanel).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5964
		    h := h + 1 + (aSubLabel heightOn:menuPanel).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5965
		] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5966
		    h := h + (self spaceBetweenEmptyLines)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5967
		]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5968
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5969
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5970
	    w := displayLabel widthOn:menuPanel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5971
	    h := displayLabel heightOn:menuPanel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5972
	].
3845
81fa525dcfa7 fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents: 3837
diff changeset
  5973
    ].
81fa525dcfa7 fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents: 3837
diff changeset
  5974
81fa525dcfa7 fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents: 3837
diff changeset
  5975
    menuPanel setFont:prevFont.     "/ restore previous font
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  5976
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5977
    "/ care for italic fonts - give a few more pixels at the end
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  5978
    myFont italic ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5979
	w := w + 2.
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5980
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5981
    displayLabelExtent := w@h.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5982
    ^ displayLabelExtent
3928
d175aca884ce fixed a font bug: used current font for extent computation,
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
  5983
d175aca884ce fixed a font bug: used current font for extent computation,
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
  5984
    "Modified: / 17-08-2010 / 10:46:06 / cg"
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5985
!
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5986
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5987
font
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5988
    "returns the user configured font or nil (default menu font)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5989
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5990
    |font|
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5991
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5992
    menuPanel isNil ifTrue:[^ nil].
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5993
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5994
    font := menuItem font.
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5995
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5996
    font notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5997
	font := font onDevice:(menuPanel device).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5998
	menuItem font:font.
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5999
    ].
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6000
    ^ font
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6001
!
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6002
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6003
font:aFont
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6004
    "returns the user configured font or nil (default menu font)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6005
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6006
    menuItem font:aFont.
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6007
!
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6008
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6009
ignoreMnemonicKeys
4076
Claus Gittinger <cg@exept.de>
parents: 4064
diff changeset
  6010
    "if true, mnemonic (access character) in the submenus under the item are ignored.
Claus Gittinger <cg@exept.de>
parents: 4064
diff changeset
  6011
     Set this to speedup accelerator key processing for slow dynamci menus"
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6012
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6013
    ^ menuItem ignoreMnemonicKeys
4076
Claus Gittinger <cg@exept.de>
parents: 4064
diff changeset
  6014
Claus Gittinger <cg@exept.de>
parents: 4064
diff changeset
  6015
    "Modified (comment): / 08-09-2011 / 04:29:47 / cg"
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6016
!
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6017
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6018
ignoreMnemonicKeys:aBoolean
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6019
    "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
  6020
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6021
    menuItem ignoreMnemonicKeys:aBoolean.
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6022
!
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6023
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6024
ignoreShortcutKeys
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6025
    "if true, shortcutKeys (accelerators) in the submenus under the item are ignored"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6026
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6027
    ^ menuItem ignoreShortcutKeys
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6028
!
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6029
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6030
ignoreShortcutKeys:aBoolean
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6031
    "if true, shortcutKeys (accelerators) in the submenus under the item are ignored"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6032
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6033
    menuItem ignoreShortcutKeys:aBoolean.
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6034
!
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6035
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6036
itemValue
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6037
    "gets the item's value"
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6038
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6039
    ^ menuItem itemValue
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6040
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6041
    "Modified (comment): / 06-03-2012 / 14:41:27 / cg"
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6042
!
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6043
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6044
itemValue:aValue
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6045
    "argument could be a value holder, an action or selector"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6046
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6047
    menuItem itemValue:aValue.
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6048
!
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6049
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6050
label
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6051
    "returns the label"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6052
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6053
    ^ label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6054
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6055
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6056
label:aLabel
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  6057
    "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
  6058
     handle characters $& (ST-80 compatibility)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6059
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6060
    |size char oldExtent|
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6061
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6062
    oldExtent          := displayLabelExtent.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6063
    displayLabelExtent := nil. "/ force a recomputation
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6064
    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
  6065
baefcb629718 Remove string specific acent handling instead of the generic #ascentOn: approach.
Stefan Vogel <sv@exept.de>
parents: 3447
diff changeset
  6066
    "Stefan: Why do we use #value two times??"
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6067
    label              := aLabel value.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6068
    displayLabel       := label value ? ''.
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6069
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6070
    displayLabel isString ifTrue:[
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6071
        "CHECK FOR SEPARATOR"
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6072
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6073
        (menuItem isButton not and:[indication isNil and:[choice isNil]]) ifTrue:[
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6074
            size := displayLabel size.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6075
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6076
            size == 0 ifTrue:[
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6077
                displayLabel := nil.            "blank separator"
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6078
                ^ self
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6079
            ].
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6080
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6081
            size == 1 ifTrue:[
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6082
                char := displayLabel first.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6083
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6084
                (char == $- or:[char == $=]) ifTrue:[
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6085
                    label := displayLabel.      "line separator"
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6086
                    displayLabel := nil.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6087
                    ^ self
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6088
                ]
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6089
            ]
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6090
        ]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6091
    ] ifFalse:[
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6092
        displayLabel isCollection ifTrue:[
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6093
            displayLabel := displayLabel asArray.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6094
        ]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6095
    ].
3328
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  6096
    menuPanel doAccessCharacterTranslation ifTrue:[
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6097
        displayLabel notNil ifTrue:[
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6098
            displayLabel isArray ifTrue:[
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6099
                displayLabel keysAndValuesDo:[:i :el|
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6100
                    el notNil ifTrue:[
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6101
                        displayLabel at:i put:(self updateAccessCharacterFor:el).
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6102
                    ].
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6103
                ].
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6104
            ] ifFalse:[
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6105
                displayLabel isImageOrForm ifFalse:[
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6106
                    displayLabel := self updateAccessCharacterFor:displayLabel.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6107
                ].
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6108
            ].
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6109
        ].
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6110
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6111
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6112
    menuPanel shown ifTrue:[
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6113
        self fetchImages.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6114
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6115
        oldExtent = self displayLabelExtent ifTrue:[
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6116
            self invalidate
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6117
        ] ifFalse:[
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6118
            menuPanel mustRearrange
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6119
        ]
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6120
    ].
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6121
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6122
    "Modified: / 06-10-2011 / 16:36:53 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6123
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6124
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6125
menuPanel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6126
    "returns my menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6127
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  6128
    ^ menuPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6129
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6130
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6131
nameKey
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6132
    "gets the nameKey"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6133
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6134
    ^ menuItem nameKey
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6135
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6136
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6137
nameKey:aNameKey
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6138
    "sets the nameKey"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6139
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6140
    menuItem nameKey:aNameKey.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6141
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6142
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6143
rawLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6144
    "returns my raw, unprocessed label"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6145
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6146
    ^ menuItem rawLabel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6147
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6148
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6149
shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6150
    "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
  6151
     no submenu exists evaluate the action assigned to the item (accept)."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6152
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6153
    ^ menuItem shortcutKey
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6154
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6155
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6156
shortcutKey:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6157
    "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
  6158
     no submenu exists evaluate the action assigned to the item (accept)."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6159
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6160
    menuItem shortcutKey ~= aKey ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6161
	menuItem shortcutKey:aKey.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6162
	self invalidate.
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  6163
    ].
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  6164
!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6165
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  6166
startGroup
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6167
    "start group #left #right #conditionalRight ... or nil
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6168
     at the moment only #right and #conditionalRight are implemented"
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6169
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6170
    ^ menuItem startGroup
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6171
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6172
    "Modified: / 16-10-2006 / 13:06:25 / cg"
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  6173
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  6174
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  6175
startGroup:aSymbol
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6176
    "start group #left #right #conditionalRight ...
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6177
     at the moment only #right and #conditionalRight are implemented"
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6178
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6179
    menuItem startGroup:aSymbol.
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6180
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6181
    "Modified: / 16-10-2006 / 13:06:37 / cg"
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  6182
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  6183
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6184
submenu
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6185
    "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
  6186
     May return nil, if there is really no menu"
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6187
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6188
    subMenu isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6189
	self setupSubmenu
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6190
    ].
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6191
    ^ subMenu
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6192
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6193
    "Modified: / 07-11-2006 / 11:09:49 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6194
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6195
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6196
submenu:aSubMenu
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6197
    "set a new submenu; an existing submenu will be destroyed.
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6198
     This might lead to a redraw if 'hasSubmenu' changed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6199
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  6200
    |widget|
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6201
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6202
    aSubMenu isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6203
	subMenu notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6204
	    subMenu destroy.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6205
	    subMenu := nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6206
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6207
	^ self
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6208
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6209
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  6210
    (aSubMenu isKindOf:Menu) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6211
	subMenu := MenuPanel new.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6212
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6213
	menuPanel notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6214
	    subMenu receiver:menuPanel receiver.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6215
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6216
	subMenu superMenu:menuPanel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6217
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6218
	menuItem horizontalLayout == true ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6219
	    subMenu verticalLayout:false
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6220
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6221
	subMenu menu:aSubMenu.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6222
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6223
	aSubMenu isView ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6224
	    (aSubMenu isKindOf:ApplicationModel) ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6225
		"/ ... mhhhh ....
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6226
		^ menuItem submenuChannel:aSubMenu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6227
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6228
	    widget := SimpleView new.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6229
	    widget client:aSubMenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6230
	] ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6231
	    widget := aSubMenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6232
	    subMenu perform:#superMenu: with:menuPanel ifNotUnderstood:[].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6233
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6234
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6235
	(widget isKindOf:MenuPanel) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6236
	    subMenu := widget.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6237
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6238
	    menuItem horizontalLayout == true ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6239
		subMenu verticalLayout:false
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6240
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6241
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6242
	    subMenu := MenuPanel new.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6243
	    subMenu receiver:menuPanel receiver.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6244
	    subMenu addSubView:widget.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6245
	    subMenu extent:(widget preferredExtent).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6246
	    widget origin:0.0@0.0 corner:1.0@1.0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6247
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6248
	subMenu superMenu:menuPanel.
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6249
    ].
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6250
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6251
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6252
submenuOrNil
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6253
    "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
  6254
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6255
    ^ subMenu
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6256
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6257
    "Created: / 07-11-2006 / 11:04:47 / cg"
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6258
!
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6259
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6260
textLabel
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6261
    "returns my textLabel or nil.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6262
     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
  6263
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6264
    |txt|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6265
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6266
    displayLabel notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6267
	displayLabel isArray ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6268
	    ^ displayLabel perform:#string ifNotUnderstood:nil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6269
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6270
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6271
	displayLabel do:[:el|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6272
	    (txt := el perform:#string ifNotUnderstood:nil) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6273
		^ txt
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6274
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6275
	].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6276
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6277
    ^ nil
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6278
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6279
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6280
triggerOnDown
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6281
    "return true if triggering the action if pressed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6282
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6283
    menuItem triggerOnDown ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6284
	self hasSubmenu ifFalse:[^ true].
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6285
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6286
    ^ false
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6287
!
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6288
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6289
triggerOnDown:aBool
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6290
    "setup to trigger the action if pressed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6291
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6292
    menuItem triggerOnDown:aBool.
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6293
!
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6294
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6295
value
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6296
    "gets the item's value
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6297
     Left here for ST80 compatibility - value is a bad name"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6298
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6299
    ^ menuItem itemValue
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6300
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6301
    "Modified (comment): / 06-03-2012 / 14:41:23 / cg"
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6302
!
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6303
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6304
value:aValue
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6305
    "could be a value holder, an action or selector
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6306
     Left here for ST80 compatibility - value: is a bad name"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6307
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6308
    menuItem itemValue:aValue.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  6309
!
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  6310
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  6311
value:aValue argument:anArgument
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6312
    "set the value and an argument"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6313
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6314
    menuItem itemValue:aValue.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6315
    menuItem  argument:anArgument.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6316
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6317
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  6318
!MenuPanel::Item methodsFor:'accessing-behavior'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6319
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6320
choice
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6321
    "implements a radio group; the field"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6322
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6323
    ^ choice
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6324
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6325
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6326
choice:something
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6327
    "set choice indication"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6328
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6329
    choice == something ifTrue:[^ self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6330
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6331
    choice isValueModel ifTrue:[
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6332
        choice removeDependent:self
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6333
    ].
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6334
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6335
    choice := something.
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6336
    choice notNil ifTrue:[
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6337
        choice isSymbol ifTrue:[
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6338
            choice := (self aspectAt:choice) ? choice.
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6339
        ].
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6340
        choice isValueModel ifTrue:[
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6341
            choice addDependent:self
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6342
        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6343
    ].
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6344
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6345
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6346
choiceValue
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6347
    "implements a radio group; the value writen to the choice if selected"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6348
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6349
    ^ menuItem choiceValue
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6350
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6351
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6352
choiceValue:something
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6353
    "implements a radio group; the value writen to the choice if selected"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6354
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6355
    menuItem choiceValue ~= something ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6356
	menuItem choiceValue:something.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6357
	choice notNil ifTrue:[ self invalidate ].
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6358
    ].
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6359
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6360
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6361
enabled
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6362
    "returns the enabled state"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6363
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6364
    |state|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6365
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6366
    menuPanel enabled ifFalse:[^ false].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6367
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6368
    enableChannel isSymbol ifTrue:[
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6369
        state := self aspectAt:enableChannel.
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6370
        state isValueModel ifTrue:[
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6371
            enableChannel := state.
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6372
            enableChannel addDependent:self.
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6373
        ].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6374
    ] ifFalse:[
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6375
        state := enableChannel.
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6376
    ].
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6377
    ^ state value ~~ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6378
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6379
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6380
enabled:something
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6381
    "change the enabled state; if the state changed, a redraw is performed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6382
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6383
    |oldState newState|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6384
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6385
    enableChannel isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6386
	oldState := true
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6387
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6388
	oldState := enableChannel value.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6389
	enableChannel isValueModel ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6390
	    enableChannel removeDependent:self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6391
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6392
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6393
    enableChannel := something.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6394
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6395
    enableChannel isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6396
	menuPanel shown ifFalse:[^ self].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6397
	newState := true
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6398
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6399
	enableChannel isValueModel ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6400
	    enableChannel addDependent:self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6401
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6402
	    enableChannel isSymbol ifTrue:[^ self]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6403
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6404
	menuPanel shown ifFalse:[^ self].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6405
	newState := enableChannel value.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6406
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6407
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6408
    newState ~~ oldState ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6409
	self invalidate
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  6410
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6411
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6412
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  6413
hideMenuOnActivated
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6414
    "hide the menu when the item was activated; the default is true"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6415
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6416
    ^ menuItem hideMenuOnActivated
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  6417
!
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  6418
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  6419
hideMenuOnActivated:aBool
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6420
   "hide the menu when the item was activated; the default is true"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6421
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6422
   menuItem hideMenuOnActivated:aBool.
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  6423
!
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  6424
2216
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6425
ifNotInUIBuilderInfoPrintCR:aMessage
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6426
    "/ q&d hack to suppress info-messages in UIBuilder
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6427
3732
1f08b49d9426 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6428
    |app|
1f08b49d9426 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6429
1f08b49d9426 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6430
    app := menuPanel application.
1f08b49d9426 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6431
2216
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6432
    (menuPanel receiver isNil
3732
1f08b49d9426 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6433
    and:[ app notNil
1f08b49d9426 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6434
    and:[ app askFor:#isUIPainter]])
2216
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6435
    ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6436
	^ self "/ suppressed
3414
b0fb84e3e809 more info about missing channel
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  6437
    ].
b0fb84e3e809 more info about missing channel
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  6438
    aMessage infoPrint.
3833
1b0bc0acc161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3830
diff changeset
  6439
"/    app notNil ifTrue:[
1b0bc0acc161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3830
diff changeset
  6440
"/        ' Application: ' infoPrint. app infoPrint
1b0bc0acc161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3830
diff changeset
  6441
"/    ].
3444
b7d2f3fe5055 avoid ultra-long lines in Transcript
Claus Gittinger <cg@exept.de>
parents: 3441
diff changeset
  6442
    '' infoPrintCR.
2216
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6443
!
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6444
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6445
indication
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6446
    "get on/off indication"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6447
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6448
    ^ indication
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6449
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6450
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6451
indication:something
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6452
    "set on/off indication"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6453
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6454
    indication == something ifTrue:[^ self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6455
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6456
    indication isValueModel ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6457
	indication removeDependent:self
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6458
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6459
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6460
    (indication := something) notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6461
	indication isValueModel ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6462
	    indication addDependent:self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6463
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6464
	    "/ to force an update of the value
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6465
	    self indicationValue
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6466
	]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6467
    ].
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  6468
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  6469
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6470
keepLinkedMenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6471
    "get the keepLinkedMenu flag"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6472
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6473
    ^ menuItem keepLinkedMenu
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6474
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6475
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6476
keepLinkedMenu:aBool
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6477
    "get the keepLinkedMenu flag"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6478
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6479
    menuItem keepLinkedMenu:aBool.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6480
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6481
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6482
sendToOriginator
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6483
    "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
  6484
     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
  6485
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6486
    ^ menuItem sendToOriginator
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6487
!
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6488
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6489
sendToOriginator:aBoolean
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6490
    "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
  6491
     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
  6492
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6493
    menuItem sendToOriginator:aBoolean.
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6494
!
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6495
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  6496
submenuChannel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6497
    "get the submenu channel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6498
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6499
    ^ menuItem submenuChannel
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  6500
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  6501
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  6502
submenuChannel:aSelectorOrNil
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6503
    "returns the submenu channel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6504
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6505
    menuItem submenuChannel:aSelectorOrNil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6506
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6507
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  6508
!MenuPanel::Item methodsFor:'accessing-dimension'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6509
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6510
moveBy:aPoint
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6511
    "move the layouts origin"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6512
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6513
    layout moveBy:aPoint.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6514
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6515
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6516
preferredExtent
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6517
    "compute my preferred extent excluding the shortCutKey and the menu identifier"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6518
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6519
    |isVertical icon wIcon isButton labelExtent
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6520
     x "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6521
     y "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6522
     s "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6523
    |
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6524
    self isVisible ifFalse:[^ 0@0 ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6525
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6526
    isButton := menuItem isButton.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6527
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6528
    isButton ifTrue:[
3987
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6529
        s := menuPanel maxAbsoluteButtonLevel ? 0.
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6530
        x := s + HorizontalButtonInset.
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6531
        y := s + VerticalButtonInset.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6532
    ] ifFalse:[
3987
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6533
        x  := HorizontalInset.
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6534
        y  := (menuPanel isPopUpView ifTrue:[VerticalPopUpInset] ifFalse:[VerticalInset]) ? 2.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6535
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6536
    x := x * 2.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6537
    y := y * 2.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6538
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6539
    isVertical := menuPanel verticalLayout.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6540
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6541
    self isSeparator ifTrue:[
3987
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6542
        s := self class separatorSize.
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6543
        label = '' ifTrue:[
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6544
            s := self class halfSeparatorSize.
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6545
        ].
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6546
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6547
        "width of doubleSeparator is 5 !!!!"
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6548
        isVertical ifFalse:[
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6549
            x := x max:s.
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6550
            y := y + 5.
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6551
        ] ifTrue:[
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6552
            y := y max:s.
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6553
            x := x + 5.
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6554
        ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6555
    ] ifFalse:[
3987
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6556
        labelExtent := self displayLabelExtent.
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6557
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6558
        x := x + labelExtent x.
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6559
        y := y + labelExtent y.
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6560
        x := x + (menuPanel stringOffsetXfor:self).
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6561
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6562
        isButton ifFalse:[
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6563
            menuPanel showSeparatingLines ifTrue:[
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6564
                "width of separator is 2 plus right offset 1 := 3"
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6565
                isVertical ifFalse:[x := x + 3] ifTrue:[y := y + 3].
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6566
            ].
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6567
        ].
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6568
        wIcon := 0.
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6569
        self hasMenuIndicator ifTrue:[
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6570
            icon := MenuPanel menuIndicator.
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6571
            wIcon := MenuPanel menuIndicatorOffset + icon width.
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6572
        ] ifFalse:[
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6573
            self hasDelayedMenuIndicator ifTrue:[
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6574
                icon := MenuPanel delayedMenuIndicator.
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6575
                wIcon := MenuPanel delayedMenuIndicatorOffset + icon width.
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6576
            ]
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6577
        ].
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6578
        x := x + wIcon.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6579
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6580
    ^ x@y
3987
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6581
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6582
    "Modified: / 19-01-2011 / 21:20:35 / cg"
3421
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  6583
!
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  6584
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  6585
preferredHeight
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  6586
    ^ self preferredExtent y
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  6587
!
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  6588
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  6589
preferredWidth
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  6590
    ^ self preferredExtent x
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6591
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6592
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  6593
!MenuPanel::Item methodsFor:'accessing-help'!
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6594
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6595
activeHelpKey
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6596
    "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
  6597
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6598
    ^ menuItem activeHelpKey
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6599
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6600
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6601
activeHelpKey:aHelpKey
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6602
    "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
  6603
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6604
    menuItem activeHelpKey:aHelpKey.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6605
    activeHelpText := nil.
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6606
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6607
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6608
activeHelpText
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6609
    "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
  6610
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6611
    |app key|
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6612
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6613
    activeHelpText notNil ifTrue:[^ activeHelpText].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6614
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6615
    ((key := self activeHelpKey) notNil
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6616
    and:[(app := menuPanel application) notNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6617
	^ app helpTextForKey:key.
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6618
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6619
    ^ nil
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6620
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6621
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6622
activeHelpText:aText
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6623
    "set the active helpText"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6624
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6625
    activeHelpText := aText.
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6626
!
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6627
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6628
flyByHelpText
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6629
    "get the flyBy helpText or nil."
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6630
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6631
    |text key app|
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6632
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6633
    flyByHelpText notNil ifTrue:[^ flyByHelpText].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6634
2574
366e5807711f separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2569
diff changeset
  6635
    self isSeparator ifTrue:[^ nil].
366e5807711f separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2569
diff changeset
  6636
2471
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  6637
    "/ its NOT the button-attribute, which controls flyByHelp suppression...
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  6638
    "/ (if you have an argument for that let us know..)
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  6639
    "/    self isButton ifFalse:[^ nil].
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  6640
    (menuPanel isNil or:[menuPanel isPopUpView]) ifTrue:[^ nil].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6641
2652
686c0f0acb90 do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  6642
    "/ if an activeHelpKey was explicitely given, use that one
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6643
    key := self activeHelpKey.
2895
4e63ee409513 flyByHelpText in Launcher
Claus Gittinger <cg@exept.de>
parents: 2888
diff changeset
  6644
    app := menuPanel application.
4e63ee409513 flyByHelpText in Launcher
Claus Gittinger <cg@exept.de>
parents: 2888
diff changeset
  6645
4e63ee409513 flyByHelpText in Launcher
Claus Gittinger <cg@exept.de>
parents: 2888
diff changeset
  6646
    "/ 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
  6647
    (key isAssociation) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6648
	app := key key.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6649
	key := key value.
2895
4e63ee409513 flyByHelpText in Launcher
Claus Gittinger <cg@exept.de>
parents: 2888
diff changeset
  6650
    ].
4e63ee409513 flyByHelpText in Launcher
Claus Gittinger <cg@exept.de>
parents: 2888
diff changeset
  6651
3402
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  6652
    key notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6653
	app notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6654
	    text := app flyByHelpTextForKey:key.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6655
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6656
	text isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6657
	    text := menuPanel flyByHelpTextForKey:key.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6658
	].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6659
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6660
2652
686c0f0acb90 do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  6661
    "/ 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
  6662
    text isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6663
	self hasSubmenu ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6664
	    ^ key
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6665
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6666
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6667
	text := key.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6668
	text isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6669
	    displayLabel isString ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6670
		text := displayLabel string.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6671
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6672
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6673
	text isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6674
	    text := self rawLabel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6675
	    text isString ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6676
		text := menuItem rawLabel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6677
		text isString ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6678
		    text := nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6679
		]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6680
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6681
	    text notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6682
		(text includes:$&) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6683
		    text := (self updateAccessCharacterFor:text) string.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6684
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6685
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6686
	].
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6687
    ].
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6688
3402
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  6689
    (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
  6690
    text = displayLabel ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6691
	"for text menus: it does not make sense to show the labels string again
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6692
	 (i.e. in a pull down menu)"
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6693
	^ nil
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6694
    ].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6695
    ^ text
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6696
!
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6697
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6698
flyByHelpText:aText
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6699
    "exlicitly set the flyBy helpText. For example, to dynamically change it."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6700
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6701
    flyByHelpText := aText.
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6702
! !
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6703
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6704
!MenuPanel::Item methodsFor:'accessing-look'!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6705
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6706
horizontalLayout
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6707
    "on default submenus has a vertical layout;
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6708
     true, the submenu has a horizontal layout."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6709
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6710
    ^ menuItem horizontalLayout ? false
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6711
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6712
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6713
horizontalLayout:aBoolean
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6714
    "on default submenus has a vertical layout;
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6715
     true, the submenu has a horizontal layout."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6716
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6717
    menuItem horizontalLayout:aBoolean.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6718
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6719
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6720
isButton
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6721
    "returns whether the item looks like a Button"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6722
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6723
    ^ menuItem isButton
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6724
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6725
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6726
isButton:aBool
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6727
    "set/clear the item to look like a Button"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6728
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6729
    menuItem isButton ~~ aBool ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6730
	menuItem isButton:aBool.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6731
	self invalidate.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6732
    ]
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6733
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6734
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6735
layout
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6736
    "returns my layout ( Rectangle )"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6737
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6738
    ^ layout
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6739
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6740
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6741
layout:aLayout
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6742
    "set a new layout ( Rectangle )"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6743
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6744
    layout := aLayout.
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6745
    self invalidate.
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6746
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6747
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6748
showBusyCursorWhilePerforming
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6749
    "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
  6750
     while performing the menu action. Defaults to false."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6751
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6752
    ^ menuItem showBusyCursorWhilePerforming
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6753
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6754
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6755
showBusyCursorWhilePerforming:aBoolean
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6756
    "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
  6757
     while performing the menu action. Defaults to false."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6758
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6759
    menuItem showBusyCursorWhilePerforming:aBoolean.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6760
! !
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6761
2504
0ce78a73aacf method category rename
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
  6762
!MenuPanel::Item methodsFor:'activation & deactivation'!
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  6763
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6764
currentSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6765
    "returns the current submenu or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6766
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6767
    ^ subMenu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6768
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6769
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  6770
hideSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6771
    "hide submenu"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6772
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6773
    self hideSubmenu:subMenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6774
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6775
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6776
hideSubmenu:aSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6777
    "hide submenu"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6778
2871
c74f2a6ff335 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2870
diff changeset
  6779
    |id wg|
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  6780
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  6781
    aSubmenu isNil ifTrue:[^ self].
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6782
    aSubmenu removeDependencies.
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6783
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6784
    aSubmenu realized ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6785
	id := aSubmenu id.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6786
	id notNil ifTrue:[ menuPanel device unmapWindow:id ]
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6787
    ] ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6788
	aSubmenu hide
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6789
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6790
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6791
    aSubmenu windowGroup:nil.
2871
c74f2a6ff335 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2870
diff changeset
  6792
    (wg := menuPanel windowGroup) notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6793
	wg removeView:aSubmenu.
2871
c74f2a6ff335 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2870
diff changeset
  6794
    ].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6795
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6796
    "/ release menu if derived from channel
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6797
    (subMenu == aSubmenu and:[menuItem submenuChannel notNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6798
	menuItem keepLinkedMenu ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6799
	    subMenu := nil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6800
	]
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6801
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6802
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6803
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6804
openDelayedSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6805
    "called to open now my delayed submenu"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6806
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6807
    |subMenuBeforeOpening|
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6808
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6809
    (self isSelected and:[menuPanel shown]) ifFalse:[^ self].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6810
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  6811
    subMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6812
	subMenu realized ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6813
	    "/ already open
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6814
	    ^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6815
	].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6816
    ].
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6817
    self setupSubmenu.
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6818
    subMenu isNil ifTrue:[^ self].
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6819
    subMenuBeforeOpening := subMenu.
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6820
    self openSubmenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6821
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6822
    (subMenuBeforeOpening == subMenu and:[self isSelected]) ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6823
	"/ closed during building or opening the submenu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6824
	self hideSubmenu:subMenuBeforeOpening.
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6825
    ].
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6826
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6827
    "Modified: / 07-11-2006 / 11:07:57 / cg"
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  6828
!
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6829
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6830
openSubmenu
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6831
    "opens the submenu; make sure, that the submenu and the menPanel
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6832
     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
  6833
     nescessary."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6834
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  6835
    |p o device isVertical topMenu windGrp prefExtent lastEvent
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6836
     devBot   "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6837
     devRight "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6838
     width    "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6839
     height   "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6840
     top      "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6841
     left     "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6842
    |
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6843
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  6844
    (subMenu isNil or:[subMenu shown or:[self isSelected not or:[menuPanel realized not]]]) ifTrue:[
3975
ca
parents: 3966
diff changeset
  6845
        ^ self
ca
parents: 3966
diff changeset
  6846
    ].
ca
parents: 3966
diff changeset
  6847
    "close all other open submenus assigned to the menuPanel I'am located in"
ca
parents: 3966
diff changeset
  6848
ca
parents: 3966
diff changeset
  6849
    menuPanel itemsDo:[:eachItem|
ca
parents: 3966
diff changeset
  6850
        (eachItem ~~ self and:[eachItem visibleSubmenu notNil]) ifTrue:[
ca
parents: 3966
diff changeset
  6851
            eachItem hideSubmenu.
ca
parents: 3966
diff changeset
  6852
        ].
ca
parents: 3966
diff changeset
  6853
    ].
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6854
    topMenu := menuPanel topMenu.
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  6855
    (subMenu device notNil and:[topMenu device ~~ subMenu device]) ifTrue:[
3975
ca
parents: 3966
diff changeset
  6856
        subMenu releaseDeviceResources.
ca
parents: 3966
diff changeset
  6857
        subMenu setDevice:topMenu device id:nil gcId:nil.
ca
parents: 3966
diff changeset
  6858
        subMenu recreate.
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  6859
    ].
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  6860
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6861
    windGrp := topMenu windowGroup.
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  6862
    windGrp notNil ifTrue:[
3975
ca
parents: 3966
diff changeset
  6863
        lastEvent := windGrp lastEvent.
ca
parents: 3966
diff changeset
  6864
ca
parents: 3966
diff changeset
  6865
        (lastEvent notNil and:[lastEvent isButtonPressEvent]) ifTrue:[
ca
parents: 3966
diff changeset
  6866
            subMenu mapTime:(lastEvent timeStamp).
ca
parents: 3966
diff changeset
  6867
        ].
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  6868
    ].
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6869
    subMenu superMenu:menuPanel.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6870
    subMenu becomesActiveMenu.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6871
    subMenu cursor:Cursor hand.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6872
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6873
    windGrp notNil ifTrue:[
3975
ca
parents: 3966
diff changeset
  6874
        subMenu windowGroup:windGrp.
ca
parents: 3966
diff changeset
  6875
        windGrp addTopView:subMenu.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6876
    ].
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6877
2111
f3d67f7c0f92 bug fix when opening a menu by mnemonic
ca
parents: 2100
diff changeset
  6878
    "Q&D kludge - test whether the layout is nil;
3975
ca
parents: 3966
diff changeset
  6879
                  if true recompute the layouts
2111
f3d67f7c0f92 bug fix when opening a menu by mnemonic
ca
parents: 2100
diff changeset
  6880
    "
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  6881
    layout isNil ifTrue:[menuPanel rearrangeItems].
2111
f3d67f7c0f92 bug fix when opening a menu by mnemonic
ca
parents: 2100
diff changeset
  6882
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  6883
    isVertical := menuPanel verticalLayout.
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  6884
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  6885
    p := isVertical ifTrue:[layout topRight - 2] ifFalse:[layout bottomLeft].
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  6886
    menuPanel isPopUpView ifTrue:[
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  6887
        o := menuPanel origin + p
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  6888
    ] ifFalse:[
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  6889
        o := menuPanel translatePoint:p to:nil.   "/ translate to root window
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  6890
    ].
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  6891
    subMenu origin:o.   "set temporary origin to compute preferredExtent"
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  6892
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6893
    " Q&D kludge - if any visibility attributes are blocks;
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6894
      TODO: only invoke mustRearrange if any are blocks
3975
ca
parents: 3966
diff changeset
  6895
            (since I react correctly on valueHolder changes)
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6896
    "
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6897
    subMenu rearrangeItemsIfItemVisibilityChanged.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6898
    subMenu fixSize.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6899
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  6900
    "compute origin of subMenu"
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6901
    device     := menuPanel device.
1714
b4c05977e9d5 get heigth and width from preferredExtent when open a submenu
ca
parents: 1710
diff changeset
  6902
    prefExtent := subMenu preferredExtent.
b4c05977e9d5 get heigth and width from preferredExtent when open a submenu
ca
parents: 1710
diff changeset
  6903
    height     := prefExtent y.
b4c05977e9d5 get heigth and width from preferredExtent when open a submenu
ca
parents: 1710
diff changeset
  6904
    width      := prefExtent x.
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  6905
    devBot     := device  usableHeightAt:o.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6906
    devRight   := device  usableWidth.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6907
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6908
    left := o x.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6909
    top  := o y.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6910
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6911
    top + height > devBot ifTrue:[
3975
ca
parents: 3966
diff changeset
  6912
        top := isVertical ifTrue:[devBot - height]
ca
parents: 3966
diff changeset
  6913
                         ifFalse:[top - layout height - height + 2]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6914
    ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6915
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6916
"/    (isVertical not and:[subMenu isVerticalLayout]) ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6917
"/        top < menuPanel bottom ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6918
"/            left := left + layout width.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6919
"/        ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6920
"/        left + width > devRight ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6921
"/            left := o x - width - 2
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6922
"/        ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6923
"/    ].
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6924
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6925
    left + width > devRight ifTrue:[
3975
ca
parents: 3966
diff changeset
  6926
        left := isVertical ifTrue:[left - layout width - width + 2]
ca
parents: 3966
diff changeset
  6927
                          ifFalse:[devRight - width]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6928
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6929
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6930
"/ ***** MULTI SCREEN
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6931
"/    top := top max:0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6932
"/    left := left max:0.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6933
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6934
    subMenu origin:(left@top).
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6935
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6936
    subMenu realized ifFalse:[
3975
ca
parents: 3966
diff changeset
  6937
        subMenu realize.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6938
    ] ifTrue:[
3975
ca
parents: 3966
diff changeset
  6939
        topMenu device mapWindow:(subMenu id).
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6940
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6941
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6942
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6943
toggleSubmenuVisibility
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6944
    "toggle the visibility of the submenu"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6945
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6946
    subMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6947
	subMenu shown ifTrue:[^ self hideSubmenu]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6948
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6949
	self setupSubmenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6950
	subMenu isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6951
	    "/ cannot open a submenu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6952
	    ^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6953
	]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6954
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6955
    self openSubmenu.
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6956
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6957
    "Modified: / 07-11-2006 / 11:06:42 / cg"
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6958
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6959
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6960
visibleSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6961
    "returns the current visible submenu or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6962
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6963
    subMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6964
	subMenu shown ifTrue:[^ subMenu].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6965
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  6966
    ^ nil
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6967
! !
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  6968
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6969
!MenuPanel::Item methodsFor:'building'!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6970
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6971
aspectAt:aKey
3092
a1dee282cab7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  6972
    "returns the value assigned to key or nil"
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6973
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6974
    |appl value|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6975
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6976
    appl := menuPanel receiver.
1219
6a0d677a6fac removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents: 1218
diff changeset
  6977
    (appl isValueModel) ifTrue:[
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6978
        ^ appl value:aKey
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6979
    ].
2123
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  6980
    appl isNil ifTrue:[
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6981
        appl := menuPanel application.
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6982
        appl isNil ifTrue:[ ^ nil].
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6983
    ].
2123
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  6984
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  6985
    MessageNotUnderstood handle:[:ex|
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6986
        ex selector ~~ aKey ifTrue:[
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6987
            ex reject
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6988
        ].
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6989
        self ifNotInUIBuilderInfoPrintCR:
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6990
            ('MenuPanel::Item [info]: application (%1) does not provide aspect: %2 (in %3)'
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6991
             bindWith:appl classNameWithArticle
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6992
             with:aKey with:label).
2123
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  6993
    ] do:[
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6994
        aKey numArgs == 1 ifTrue:[
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6995
            value := appl perform:aKey with:(menuItem argument ? self).
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6996
        ] ifFalse:[
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6997
            (appl respondsTo:#aspectFor:) ifTrue:[
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6998
                value := appl aspectFor:aKey
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6999
            ] ifFalse:[
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7000
                value := appl perform:aKey
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7001
            ]
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7002
        ]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7003
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7004
    ^ value
1029
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  7005
3092
a1dee282cab7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  7006
    "Modified: / 05-10-2006 / 03:10:20 / cg"
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7007
! !
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7008
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7009
!MenuPanel::Item methodsFor:'change & update'!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7010
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7011
fontChanged
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7012
    "called whenever the font changed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7013
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7014
    displayLabel notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7015
	displayLabelExtent := nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7016
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7017
	subMenu notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7018
	    subMenu font:(menuPanel font).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7019
	].
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7020
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7021
!
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7022
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7023
update:something with:aParameter from:changedObject
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7024
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7025
    |form rect|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7026
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7027
    (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
  7028
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7029
    self isSeparator ifFalse:[
4090
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7030
        "/ NOT A SEPARATOR
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7031
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7032
        menuPanel shown ifTrue:[
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7033
            changedObject == enableChannel ifTrue:[
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7034
                (enableChannel value == false and:[self isSelected]) ifTrue:[
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7035
                    ^ menuPanel selection:nil.
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7036
                ].
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7037
                ^ self invalidate
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7038
            ].
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7039
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7040
            (changedObject == indication or:[changedObject == choice]) ifTrue:[
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7041
                menuItem isButton ifTrue:[
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7042
                    self invalidate
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7043
                ] ifFalse:[
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7044
                    "/ invalidate the interactor only
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7045
                    "/ take any interactor; interactors has the same extent
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7046
                    form := menuPanel iconIndicationOff.
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7047
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7048
                    rect := Rectangle left:(layout left + HorizontalInset)
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7049
                                       top:(layout top)
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7050
                                     width:(form width)
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7051
                                    height:(layout height).
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7052
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7053
                    menuPanel invalidate:rect repairNow:false
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7054
                ].
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7055
                ^ self
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7056
            ].
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7057
            self invalidate.
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7058
        ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  7059
    ].
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7060
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7061
    changedObject == isVisible ifTrue:[
4090
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7062
        menuPanel mustRearrange.
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7063
        "/ actually: the following is wrong, because we have to delay the rearrangement
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7064
        "/ until the next redraw event comes. Otherwise, we might compute new layouts
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7065
        "/ too early if more items change their visibility.
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7066
        "/ redraw will call rearrangeItems, if the mustRearrange is set.
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7067
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7068
        "/ menuPanel rearrangeItems.
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7069
        ^ self.
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7070
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7071
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  7072
    super update:something with:aParameter from:changedObject
4090
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7073
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7074
    "Modified (comment): / 24-11-2011 / 19:01:42 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7075
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7076
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7077
updateIndicators
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7078
    "update indicators "
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7079
2934
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  7080
    indication notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7081
	(indication isSymbol
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7082
	or:[menuItem hideMenuOnActivated not])
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7083
	ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7084
	    "indication is a selector;
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7085
	     otherwise no need to redraw, because
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7086
	     a change notification is raised from the model !!!!"
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7087
	    self update:nil with:nil from:indication
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7088
	]
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  7089
    ]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7090
! !
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7091
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7092
!MenuPanel::Item methodsFor:'converting'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7093
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7094
asMenuItem
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7095
    "convert to a MenuItem"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7096
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7097
    ^ menuItem
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7098
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7099
2827
139c1089bcb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  7100
menuItem
139c1089bcb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  7101
    ^ menuItem
139c1089bcb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  7102
!
139c1089bcb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  7103
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7104
menuItem:aMenuItem
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7105
    "setup attributes from a MenuItem"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7106
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7107
    |lbl|
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  7108
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7109
    menuPanel disabledRedrawDo:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7110
	menuItem := aMenuItem.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7111
	menuItem isNil ifTrue:[ menuItem := MenuItem new].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7112
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7113
	label := displayLabel := activeHelpText := nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7114
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7115
	self    enabled:(menuItem enabled).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7116
	self indication:(menuItem indication).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7117
	self     choice:(menuItem choice).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7118
	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
  7119
2855
c7f3481ff14a redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents: 2844
diff changeset
  7120
"/ 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
  7121
"/ but ... ??
2855
c7f3481ff14a redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents: 2844
diff changeset
  7122
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7123
	(lbl := menuItem labelImage value) isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7124
	    lbl := menuItem rawLabel. "/ avoid translating &'s twice
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7125
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7126
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7127
	self submenu:(menuItem submenu).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7128
	self label:lbl.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7129
    ]
1033
9badc22e3d03 oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents: 1032
diff changeset
  7130
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  7131
    "Modified: / 22.8.1998 / 15:34:16 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7132
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7133
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7134
!MenuPanel::Item methodsFor:'dependents access'!
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7135
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7136
addDependencies
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7137
    "add all dependencies"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7138
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7139
    enableChannel isValueModel ifTrue:[enableChannel addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7140
    isVisible     isValueModel ifTrue:[isVisible     addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7141
    indication    isValueModel ifTrue:[indication    addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7142
    choice        isValueModel ifTrue:[choice        addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7143
!
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7144
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7145
removeDependencies
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7146
    "remove all dependencies"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7147
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7148
    enableChannel isValueModel ifTrue:[enableChannel removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7149
    isVisible     isValueModel ifTrue:[isVisible     removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7150
    indication    isValueModel ifTrue:[indication    removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7151
    choice        isValueModel ifTrue:[choice        removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7152
! !
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7153
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7154
!MenuPanel::Item methodsFor:'drawing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7155
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7156
choiceForm
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7157
    "returns choice form or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7158
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7159
    |isOn|
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7160
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7161
    choice isNil ifTrue:[^ nil].
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7162
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7163
    isOn := (choice value = menuItem choiceValue).
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7164
    self enabled ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7165
	^ isOn ifTrue:[menuPanel iconRadioGroupDisabledOn]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7166
	       ifFalse:[menuPanel iconRadioGroupDisabledOff]
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7167
    ].
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7168
    self isSelected ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7169
	^ isOn == true
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7170
	    ifTrue:[menuPanel iconRadioGroupEnteredOn]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7171
	    ifFalse:[menuPanel iconRadioGroupEnteredOff]
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7172
    ].
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7173
    ^ isOn ifTrue:[menuPanel iconRadioGroupOn]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7174
	   ifFalse:[menuPanel iconRadioGroupOff]
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7175
!
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7176
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7177
draw
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7178
    "redraw this item"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7179
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7180
    |isSelected ownBgCol paint bgColor
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7181
     x  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7182
     y  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7183
     w  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7184
     h  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7185
    |
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7186
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7187
    self isVisible ifFalse:[^ self].
4152
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7188
    layout isNil ifTrue:[
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7189
        "/ cg: why does this happen - it does!!
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7190
        ^ self
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7191
    ].
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7192
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7193
    self isSeparator ifTrue:[
4152
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7194
        self drawSeparator.
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7195
        ^ self
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7196
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7197
    menuItem isButton ifTrue:[
4152
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7198
        self drawButton.
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7199
        ^ self
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7200
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7201
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7202
    "/ DRAW A LABELED ENTRY; no button, no separator
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7203
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7204
    isSelected := self isSelected.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7205
    bgColor    := menuPanel backgroundColor.
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7206
    paint      := isSelected
4152
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7207
                    ifTrue:[self activeBackgroundColor]
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7208
                    ifFalse:[
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7209
                        (self isEnabled and:[ self isEntered ]) ifTrue:[
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7210
                            menuPanel enteredBackgroundColor
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7211
                        ] ifFalse:[
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7212
                            bgColor
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7213
                        ]].
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7214
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7215
    (ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[
4152
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7216
        paint := ownBgCol
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7217
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7218
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7219
    paint ~= bgColor ifTrue:[
4152
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7220
        menuPanel paint:paint.
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7221
        menuPanel fillRectangle:layout.
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7222
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7223
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7224
    menuPanel showSeparatingLines ifTrue:[
4152
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7225
        self drawSeparatingLines
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7226
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7227
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7228
    self drawLabel.
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7229
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7230
    (ownBgCol notNil and:[isSelected]) ifTrue:[
4152
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7231
        ownBgCol brightness > 0.5 ifTrue:[menuPanel paint: menuPanel selectionFrameDarkColor]
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7232
                                 ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor].
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7233
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7234
        x := layout left.
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7235
        y := layout top.
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7236
        w := layout width.
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7237
        h := layout height.
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7238
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7239
        menuPanel displayRectangleX:(x + 1) y:(y + 1) width:(w - 2) height:(h - 2).
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7240
        menuPanel displayRectangleX:(x + 2) y:(y + 2) width:(w - 4) height:(h - 4).
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7241
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7242
    menuPanel drawLabelEdgeFor:self selected:isSelected.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7243
!
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7244
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7245
drawButton
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7246
    "draw as button"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7247
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7248
    |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
  7249
     x "{ Class:SmallInteger }"
2143
7b99a7348c97 draw label shifted right-down when pressed
penk
parents: 2142
diff changeset
  7250
     y "{ Class:SmallInteger }"
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7251
    |
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7252
    drawObject := displayLabel.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7253
    isEnabled  := self enabled.
2159
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  7254
    isSelected := self isSelected.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7255
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7256
    isSelected ifFalse:[
3976
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7257
        "/ test whether button has pressed toggle behaviour
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7258
        showSelected := (self isToggle and:[self indicationValue]).
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7259
    ] ifTrue:[
3976
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7260
        showSelected := isSelected
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7261
    ].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7262
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7263
    showSelected ifTrue:[
3976
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7264
        bg := self activeBackgroundColor.
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7265
        fg := self activeForegroundColor.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7266
    ] ifFalse:[
3976
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7267
        self isEntered ifTrue:[
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7268
            bg := self buttonEnteredBackgroundColor
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7269
        ] ifFalse:[
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7270
            bg := self backgroundColor
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7271
        ].
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7272
        isEnabled ifTrue:[
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7273
            fg := menuPanel foregroundColor
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7274
        ] ifFalse:[
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7275
            fg := menuPanel disabledForegroundColor.
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7276
            etchFg := menuPanel disabledEtchedForegroundColor.
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7277
            drawObject := self disabledRawLabel
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7278
        ]
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7279
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7280
1708
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  7281
    (ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[
3976
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7282
        bg := ownBgCol
1708
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  7283
    ].
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  7284
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7285
    "DRAW BACKGROUND"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7286
    bg ~= menuPanel backgroundColor ifTrue:[
3976
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7287
        menuPanel paint:bg.
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7288
        menuPanel fillRectangle:layout.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7289
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7290
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7291
    x := layout left + menuPanel buttonPassiveLevel + HorizontalButtonInset.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7292
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7293
    (drawObject isImage and:[menuPanel centerItems]) ifTrue:[
3976
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7294
        x := x + (layout width - menuPanel buttonPassiveLevel - HorizontalButtonInset - 1 - drawObject width // 2).
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  7295
    ].
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7296
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7297
    isSelected ifFalse:[
3976
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7298
        "check whether button should be drawn selected; indicator or radio button"
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7299
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7300
        indication notNil ifTrue:[
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7301
            "button is indicator and set"
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7302
            isSelected := self indicationValue
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7303
        ] ifFalse:[
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7304
            isSelected := (choice notNil and:[choice value = menuItem choiceValue]).
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7305
        ]
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7306
    ].
2143
7b99a7348c97 draw label shifted right-down when pressed
penk
parents: 2142
diff changeset
  7307
    y := 0.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7308
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7309
    isSelected ifTrue:[
3976
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7310
        level := menuPanel buttonActiveLevel.
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7311
        x     := x + 1 "level abs".
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7312
        y     := y + 1 "level abs".
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7313
    ] ifFalse:[
3976
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7314
        level := self isEntered ifTrue:[menuPanel buttonEnteredLevel]
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7315
                               ifFalse:[menuPanel buttonPassiveLevel].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7316
    ].
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7317
2817
805bb3b2ef28 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2793
diff changeset
  7318
    drawObject notEmptyOrNil ifTrue:[
3976
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7319
        etchFg notNil ifTrue:[
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7320
            "/ donot draw images twice.. images are shown lightened
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7321
            drawObject isImageOrForm ifFalse:[
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7322
                self drawRawLabel:drawObject atX:x+1 yOffset:y+1 paint:etchFg.
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7323
            ].
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7324
        ].
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7325
        self drawRawLabel:drawObject atX:x yOffset:y+0 paint:fg.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7326
    ].
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7327
    self drawMenuIndicator.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7328
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7329
    level ~~ 0 ifTrue:[
3976
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7330
        menuPanel drawButtonEdgesFor:self level:level
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7331
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7332
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7333
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7334
drawLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7335
    "draw a labeled entry; no button, no separator."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7336
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7337
    |scKey cLb cLa drawObject fg etchFg arrow
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7338
     isSelected isEnabled form
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7339
     h "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7340
     y "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7341
     x "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7342
     t "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7343
    |
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7344
    drawObject := displayLabel.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7345
    isEnabled  := self enabled.
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7346
    isSelected := self isSelected.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7347
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7348
    isSelected ifTrue:[
3976
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7349
        fg := self activeForegroundColor
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7350
    ] ifFalse:[
3976
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7351
        isEnabled ifTrue:[
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7352
            self isEntered ifTrue:[
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7353
                fg := menuPanel enteredForegroundColor
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7354
            ] ifFalse:[
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7355
                fg := menuPanel foregroundColor
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7356
            ]
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7357
        ] ifFalse:[
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7358
            fg          := menuPanel disabledForegroundColor.
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7359
            etchFg      := menuPanel disabledEtchedForegroundColor.
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7360
            drawObject  := self disabledRawLabel
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7361
        ]
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7362
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7363
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7364
    h := layout height.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7365
    x := layout left + HorizontalInset.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7366
    t := layout top.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7367
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  7368
    (    (form := self indicatorForm) notNil
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  7369
     or:[(form := self choiceForm) notNil]
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  7370
    ) ifTrue:[
3976
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7371
        y := t + ((h - form height) // 2).
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7372
        form displayOn:menuPanel x:x y:y.
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7373
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7374
2817
805bb3b2ef28 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2793
diff changeset
  7375
    drawObject notEmptyOrNil ifTrue:[
3976
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7376
        x := x + (menuPanel stringOffsetXfor:self).
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7377
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7378
        etchFg notNil ifTrue:[
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7379
            "/ donot draw images twice.. images are shown lightened
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7380
            drawObject isImageOrForm ifFalse:[
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7381
                self drawRawLabel:drawObject atX:x+1 yOffset:1 paint:etchFg.
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7382
            ].
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7383
        ].
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7384
        self drawRawLabel:drawObject atX:x yOffset:0 paint:fg.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7385
    ].
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7386
    self drawMenuIndicator.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7387
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7388
    "/ DRAW SHORTCUT KEY
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7389
    (     menuItem shortcutKey notNil
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7390
     and:[(x := menuPanel shortKeyInset) ~~ 0
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7391
     and:[(scKey:= self shortcutKeyAsString) notNil]]
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7392
    ) ifTrue:[
3976
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7393
        x := layout left + x.
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7394
        y := t + ((h - (scKey heightOn:menuPanel)) // 2).
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7395
        y := y + menuPanel font ascent.
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7396
        scKey displayOn:menuPanel x:x y:y.
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7397
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7398
3403
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  7399
    "/ DRAW SUBMENU INDICATION (if a vertical menu with submenu)
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  7400
    (menuPanel isVerticalLayout and:[self hasSubmenu]) ifTrue:[
3976
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7401
        arrow := menuPanel rightArrow.
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7402
        x := layout right - arrow width - HorizontalInset.
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7403
        y := t + ((h - arrow height) // 2).
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7404
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7405
        (menuPanel styleSheet is3D not
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7406
        or:[(drawObject := menuPanel rightArrowShadow) isNil]) ifTrue:[
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7407
            menuPanel displayForm:arrow x:x y:y.
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7408
        ] ifFalse:[
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7409
            cLa := menuPanel shadowColor.
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7410
            cLb := menuPanel lightColor.
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7411
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7412
            isSelected ifFalse:[
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7413
                fg  := cLa.
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7414
                cLa := cLb.
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7415
                cLb := fg
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7416
            ].
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7417
            menuPanel paint:cLa.
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7418
            menuPanel displayForm:arrow x:x y:y.
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7419
            menuPanel paint:cLb.
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7420
            menuPanel displayForm:drawObject x:x y:y.
b4631e698205 bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents: 3975
diff changeset
  7421
        ].
3403
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  7422
    ].
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7423
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7424
    "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
  7425
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7426
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7427
drawMenuIndicator
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7428
    "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
  7429
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7430
    |x y icon bAbsLevel verticalPosition|
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7431
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7432
    icon := self menuIndicatorIcon.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7433
    icon isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7434
	^ self
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7435
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7436
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7437
    x := layout right  - icon width.
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7438
    verticalPosition := menuPanel menuIndicatorVerticalPosition.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7439
    verticalPosition == #center ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7440
	y := (layout height - icon height) // 2 + layout top.
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7441
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7442
	verticalPosition == #top ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7443
	    y := layout top + 2.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7444
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7445
	    y := layout bottom - icon height - 2.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7446
	]
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7447
    ].
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7448
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7449
    bAbsLevel := 0.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7450
    menuItem isButton ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7451
	self isSelected ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7452
	    x := x + 1.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7453
	    y := y + 1.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7454
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7455
	bAbsLevel := menuPanel maxAbsoluteButtonLevel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7456
	x := x - bAbsLevel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7457
	y := y - bAbsLevel.
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7458
    ].
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7459
    x := x - 1 "- HorizontalInset".
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7460
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7461
    (self isEnabled "and:[self delayedMenuIsEnabled]") ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7462
	icon := menuPanel lightenedImageOnDevice:icon
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7463
    ].
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7464
    icon displayOn:menuPanel x:x y:y.
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7465
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7466
    (menuPanel drawMenuIndicatorSeparatorLine
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7467
	and:[ self isEntered
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7468
	and:[ menuPanel buttonEnteredLevel ~~ 0] ])
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7469
    ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7470
	menuPanel paint:menuPanel buttonShadowColor.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7471
	menuPanel displayLineFromX:x-2 y:layout top+bAbsLevel+1 toX:x-2 y:layout bottom-bAbsLevel-2.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7472
	menuPanel paint:menuPanel buttonLightColor.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7473
	menuPanel displayLineFromX:x-1 y:layout top+bAbsLevel+1 toX:x-1 y:layout bottom-bAbsLevel-2.
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7474
    ].
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7475
!
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7476
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7477
drawRawLabel:aLabel atX:x yOffset:yOffset paint:fg
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7478
    "draw a labeled entry; no button, no separator."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7479
3486
c54b6691e60e variable naming
Stefan Vogel <sv@exept.de>
parents: 3457
diff changeset
  7480
    |oldFont labelExtent
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  7481
     y  "{ Class:SmallInteger }"
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7482
     y0 "{ Class:SmallInteger }"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7483
     x0 "{ Class:SmallInteger }"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7484
    |
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7485
3486
c54b6691e60e variable naming
Stefan Vogel <sv@exept.de>
parents: 3457
diff changeset
  7486
    oldFont := menuPanel setFont:(self font).
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7487
    "/ fontAscent := menuPanel font ascent.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7488
    menuPanel paint:fg.
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7489
    labelExtent := self displayLabelExtent.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7490
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7491
    y := layout top + (layout height - labelExtent y // 2) + yOffset.
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  7492
"/  menuPanel centerItems ifTrue:[self halt].
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7493
    aLabel isArray ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7494
	|printLabel|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7495
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7496
	aLabel isText ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7497
	    "/ background of label has already been drawn
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7498
	    printLabel := aLabel withoutBackgroundColorEmphasis.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7499
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7500
	    printLabel := aLabel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7501
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7502
	y := y + (printLabel ascentOn:menuPanel).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7503
	printLabel displayOn:menuPanel x:x y:y.
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  7504
    ] ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7505
	aLabel do:[:el|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7506
	    el notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7507
		y0 := y + (el ascentOn:menuPanel).
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7508
"/                el isImageOrForm ifFalse:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7509
"/                    y0 := y + fontAscent
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7510
"/                ] ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7511
"/                    y0 := y
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7512
"/                ].
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7513
		x0 := x + (labelExtent x - (el widthOn:menuPanel) // 2).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7514
		el displayOn:menuPanel x:x0 y:y0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7515
		y := y + 1 + (el heightOn:menuPanel)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7516
	    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7517
		y := y + (self spaceBetweenEmptyLines)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7518
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7519
	].
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  7520
    ].
3486
c54b6691e60e variable naming
Stefan Vogel <sv@exept.de>
parents: 3457
diff changeset
  7521
    menuPanel setFont:oldFont
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7522
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7523
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7524
drawSeparatingLines
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7525
    "draw separating lines"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7526
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7527
    |myIndex lfSep rtSep items prevItem nextItem
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7528
     lightColor shadowColor
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7529
     l "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7530
     t "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7531
     r "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7532
     b "{ Class:SmallInteger }"
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  7533
    |
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7534
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7535
    items := menuPanel items.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7536
    myIndex := items identityIndexOf:self.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7537
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7538
    prevItem  := items at:(myIndex - 1) ifAbsent:nil.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7539
    lfSep := prevItem notNil and:[prevItem isButton not].
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7540
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7541
    nextItem  := items at:(myIndex + 1) ifAbsent:nil.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7542
    rtSep := nextItem notNil and:[nextItem isButton not].
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7543
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7544
    (lfSep or:[rtSep]) ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7545
	^ self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7546
    ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7547
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7548
    lightColor := menuPanel lightColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7549
    shadowColor := menuPanel shadowColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7550
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7551
    menuPanel paint:lightColor.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7552
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7553
    l := layout left.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7554
    t := layout top.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7555
    r := layout right.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7556
    b := layout bottom.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7557
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7558
    menuPanel verticalLayout ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7559
	lfSep ifTrue:[menuPanel displayLineFromX:l y:t-1 toX:r y:t-1].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7560
	rtSep ifTrue:[menuPanel displayLineFromX:l y:b-1 toX:r y:b-1].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7561
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7562
	menuPanel paint:shadowColor.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7563
	lfSep ifTrue:[menuPanel displayLineFromX:l y:t-2 toX:r y:t-2].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7564
	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
  7565
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7566
	lfSep ifTrue:[menuPanel displayLineFromX:l-1 y:t toX:l-1 y:b].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7567
	rtSep ifTrue:[menuPanel displayLineFromX:r-1 y:t toX:r-1 y:b].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7568
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7569
	menuPanel paint:shadowColor.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7570
	lfSep ifTrue:[menuPanel displayLineFromX:l-2 y:t toX:l-2 y:b].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7571
	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
  7572
    ]
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7573
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7574
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7575
drawSeparator
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7576
    "draw as separator"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7577
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7578
    |type lightColor shadowColor isDouble
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7579
     left top
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7580
     x0  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7581
     x1  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7582
     y0  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7583
     y1  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7584
    |
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7585
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7586
    type := self separatorType.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7587
    (type isNil or:[type == #blankLine]) ifTrue:[
4152
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7588
        ^ self
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7589
    ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7590
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7591
    isDouble := type == #doubleLine.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7592
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7593
    lightColor := menuPanel lightColor.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7594
    shadowColor := menuPanel shadowColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7595
    menuPanel paint:shadowColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7596
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7597
    left := layout left.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7598
    top := layout top.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7599
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7600
    menuPanel verticalLayout ifTrue:[
4152
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7601
        x0 := left  + HorizontalInset.
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7602
        x1 := layout right - HorizontalInset.
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7603
        y0 := top   - 1 + (layout height // 2).
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7604
        isDouble ifTrue:[y0 := y0 - 2].
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7605
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7606
        menuPanel displayLineFromX:x0 y:y0   toX:x1 y:y0.
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7607
        isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+4 toX:x1 y:y0+4].
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7608
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7609
        menuPanel paint:lightColor.
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7610
        menuPanel displayLineFromX:x0 y:y0+1 toX:x1 y:y0+1.
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7611
        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
  7612
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7613
    ] ifFalse:[
4152
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7614
        y1 := layout bottom.
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7615
        x0 := left - 1 + (layout width // 2).
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7616
        y0 := top.
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7617
        isDouble ifTrue:[x0 := x0 - 2].
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7618
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7619
        menuPanel displayLineFromX:x0   y:y0 toX:x0   y:y1.
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7620
        isDouble ifTrue:[menuPanel displayLineFromX:x0+4 y:y0 toX:x0+4 y:y1].
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7621
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7622
        menuPanel paint:lightColor.
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7623
        menuPanel displayLineFromX:x0+1 y:y0 toX:x0+1 y:y1.
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7624
        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
  7625
    ]
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7626
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7627
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7628
indicatorForm
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7629
    "returns indication form or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7630
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7631
    |isOn|
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7632
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7633
    indication isNil ifTrue:[^ nil].
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7634
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7635
    isOn := self indicationValue.
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7636
    self enabled ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7637
	^ isOn == true
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7638
	    ifTrue:[menuPanel iconIndicationDisabledOn]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7639
	    ifFalse:[menuPanel iconIndicationDisabledOff]
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7640
    ].
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7641
"/    self isSelected ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7642
"/        ^ isOn == true
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7643
"/            ifTrue:[menuPanel iconIndicationEnteredOn]
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7644
"/            ifFalse:[menuPanel iconIndicationEnteredOff]
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7645
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7646
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7647
    ^ isOn == true
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7648
	ifTrue:[menuPanel iconIndicationOn]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7649
	ifFalse:[menuPanel iconIndicationOff]
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7650
!
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7651
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7652
invalidate
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7653
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7654
    layout isNil ifTrue:[^ self].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7655
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7656
    (displayLabel notNil and:[menuPanel notNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7657
	menuPanel invalidateItem:self repairNow:false
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7658
    ]
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7659
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7660
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7661
menuIndicatorIcon
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7662
    "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
  7663
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7664
    self hasDelayedMenuIndicator ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7665
	^ MenuPanel delayedMenuIndicator.
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7666
    ].
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7667
    self hasMenuIndicator ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7668
	^ MenuPanel menuIndicator.
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7669
    ].
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7670
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7671
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7672
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7673
!MenuPanel::Item methodsFor:'initialization'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7674
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7675
destroy
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7676
    "destroy submenus, remove dependencies"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7677
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  7678
    self submenu:nil.
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7679
    self removeDependencies.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  7680
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7681
    menuPanel := nil.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  7682
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  7683
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7684
in:aPanel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7685
    "create item in a menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7686
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7687
    menuPanel := aPanel.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7688
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7689
    menuItem isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7690
	self breakPoint:#ca.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7691
	menuItem := MenuItem new
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7692
    ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7693
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7694
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7695
initialize
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7696
    menuItem := MenuItem new.
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7697
!
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7698
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7699
reinitStyle
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7700
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7701
    subMenu notNil ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  7702
	subMenu reinitStyle
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7703
    ].
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7704
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7705
    "Created: / 17.8.2000 / 17:57:07 / cg"
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7706
    "Modified: / 17.8.2000 / 18:00:08 / cg"
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7707
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7708
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7709
!MenuPanel::Item methodsFor:'label basics'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7710
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7711
disabledRawLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7712
    "returns the label used if the item is disabled"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7713
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7714
    |block form image|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7715
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7716
    disabledDisplayLabel notNil ifTrue:[^ disabledDisplayLabel].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7717
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7718
    disabledDisplayLabel := displayLabel ? ''.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7719
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7720
    disabledDisplayLabel isString ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7721
	^ disabledDisplayLabel
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7722
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7723
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7724
    block := [:el| |rslt|
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7725
	(rslt := el) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7726
	    el isImageOrForm ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7727
		el colorMap notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7728
		    rslt := menuPanel lightenedImageOnDevice:el
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7729
		]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7730
	    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7731
		(displayLabel isKindOf:LabelAndIcon) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7732
		    ((form := el icon) notNil and:[form colorMap notNil]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7733
			form := menuPanel lightenedImageOnDevice:form
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7734
		    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7735
		    ((image := el image) notNil and:[image colorMap notNil]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7736
			image := menuPanel lightenedImageOnDevice:image
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7737
		    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7738
		    rslt := LabelAndIcon form:form image:image string:(el string).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7739
		]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7740
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7741
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7742
	rslt
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7743
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7744
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7745
    displayLabel isArray ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7746
	disabledDisplayLabel := Array new:(displayLabel size).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7747
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7748
	displayLabel keysAndValuesDo:[:anIndex :aLabel|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7749
	    disabledDisplayLabel at:anIndex put:(block value:aLabel)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7750
	]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7751
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7752
	disabledDisplayLabel := block value:displayLabel
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7753
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7754
    ^ disabledDisplayLabel
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7755
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7756
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  7757
fetchDeviceResources
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  7758
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7759
    disabledDisplayLabel := nil.
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  7760
    self fetchImages.
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  7761
!
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  7762
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  7763
fetchImages
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7764
    "fetch my icon images"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7765
2118
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  7766
    |icon|
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  7767
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7768
    (displayLabel isNil or:[displayLabel isString]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7769
	^ self
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7770
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7771
    displayLabel isImageOrForm ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7772
	displayLabel := menuPanel imageOnMyDevice:displayLabel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7773
	^ self.
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7774
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7775
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7776
    (displayLabel isKindOf:LabelAndIcon) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7777
	(icon := displayLabel image) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7778
	    displayLabel image:(menuPanel imageOnMyDevice:icon)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7779
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7780
	(icon := displayLabel icon) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7781
	    displayLabel icon:(menuPanel imageOnMyDevice:icon)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7782
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7783
	^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7784
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7785
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7786
    displayLabel isArray ifFalse:[^ self].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7787
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7788
    displayLabel keysAndValuesDo:[:i :el|
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7789
	(el notNil and:[el isString not]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7790
	    el isImageOrForm ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7791
		displayLabel at:i put:(menuPanel imageOnMyDevice:el).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7792
	    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7793
		el class == LabelAndIcon ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7794
		    (icon := el image) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7795
			el image:(menuPanel imageOnMyDevice:icon)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7796
		    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7797
		    (icon := el icon) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7798
			el icon:(menuPanel imageOnMyDevice:icon)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7799
		    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7800
		]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7801
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7802
	]
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  7803
    ].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7804
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7805
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7806
updateAccessCharacterFor:aLabel
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  7807
    "replace &x by the short-key attribute (i.e. remove & and underline x)"
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  7808
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  7809
    accessCharacter notNil ifTrue:[^ aLabel].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7810
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7811
    aLabel isString ifFalse:[
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  7812
        aLabel class == LabelAndIcon ifTrue:[
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  7813
            aLabel string:(self updateAccessCharacterFor:(aLabel string))
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  7814
        ].
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  7815
        ^ aLabel
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  7816
    ].
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  7817
4108
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
  7818
    ^ MenuPanel 
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
  7819
                processAmpersandCharactersFor:aLabel 
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
  7820
                withAccessCharacterPosition:(menuItem accessCharacterPosition).
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
  7821
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
  7822
    "Modified: / 15-02-2012 / 18:53:11 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7823
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7824
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  7825
!MenuPanel::Item methodsFor:'printing & storing'!
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  7826
4139
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  7827
displayOn:aGCOrStream
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  7828
    "Compatibility
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  7829
     append a printed desription on some stream (Dolphin,  Squeak)
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  7830
     OR:
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  7831
     display the receiver in a graphicsContext at 0@0 (ST80).
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  7832
     This method allows for any object to be displayed in some view
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  7833
     (although the fallBack is to display its printString ...)"
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  7834
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  7835
    "/ what a kludge - Dolphin and Squeak mean: printOn: a stream;
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  7836
    "/ ST/X (and some old ST80's) mean: draw-yourself on a GC.
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  7837
    aGCOrStream isStream ifFalse:[
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  7838
        ^ super displayOn:aGCOrStream.
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  7839
    ].
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  7840
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  7841
    aGCOrStream 
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  7842
        nextPutAll:self class name;
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  7843
        nextPut:$(.
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  7844
    label displayOn:aGCOrStream.
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  7845
    aGCOrStream nextPut:$).
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  7846
! !
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  7847
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7848
!MenuPanel::Item methodsFor:'private'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7849
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  7850
activeBackgroundColor
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7851
    "returns the active background color derived from menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7852
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7853
    menuItem isButton ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7854
	^ menuPanel buttonActiveBackgroundColor
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7855
    ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7856
    ^ menuPanel activeBackgroundColor
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  7857
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  7858
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  7859
activeForegroundColor
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7860
    "returns the active foreground color derived from menuPanel"
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  7861
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  7862
    menuItem isButton ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7863
	^ menuPanel buttonActiveForegroundColor
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  7864
    ].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  7865
    ^menuPanel activeForegroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  7866
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  7867
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  7868
backgroundColor
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7869
    "returns the background color derived from menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7870
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7871
    menuItem isButton ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7872
	^ menuPanel buttonPassiveBackgroundColor
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7873
    ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7874
    ^ menuPanel backgroundColor
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  7875
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  7876
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7877
backgroundColorFromLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7878
    "returns the background color derived from label or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7879
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7880
    |run|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7881
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7882
    label isText ifFalse:[^ nil ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7883
    run := label emphasis.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7884
    run size == 0 ifTrue:[^ nil ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7885
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7886
    run := run first.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7887
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7888
    run size == 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7889
	(run value isColor and:[run key == #backgroundColor]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7890
	    ^ run value
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7891
	]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7892
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7893
	run do:[:r|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7894
	    (r value isColor and:[r key == #backgroundColor]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7895
		^ r value
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7896
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7897
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7898
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7899
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7900
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7901
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  7902
buttonEnteredBackgroundColor
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7903
    "returns the background color to use when thhe mouse has entered
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7904
     derived from menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7905
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7906
    menuItem isButton ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7907
	^ menuPanel buttonEnteredBackgroundColor
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7908
    ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  7909
    ^ menuPanel backgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  7910
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  7911
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  7912
findSubMenuIn:aRecv
1051
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  7913
    "ask the receiver for a submenu aspect, sending it
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  7914
     #aspectFor: first; then trying the selector itself.
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  7915
     Ignore the error if that message is not understood
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  7916
     (but not other message-not-understoods)"
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  7917
3866
fbdbf71489d8 show no menu, if there is no menu.
Claus Gittinger <cg@exept.de>
parents: 3845
diff changeset
  7918
    |subm sel numArgs gotMenu|
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  7919
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  7920
    aRecv isNil ifTrue:[^ nil].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  7921
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7922
    sel := menuItem submenuChannel.
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  7923
    (sel isString or:[sel isSymbol]) ifFalse:[^ nil].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7924
    sel := sel asSymbol.
2069
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  7925
    numArgs := sel numArgs.
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  7926
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  7927
    numArgs == 0 ifTrue:[
4025
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7928
        gotMenu := false.
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7929
        MessageNotUnderstood handle:[:ex |
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7930
            |selector|
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7931
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7932
            ((selector := ex selector) == sel
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7933
            or:[selector == #aspectFor:]) ifFalse:[
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7934
                ex reject
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7935
            ].
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7936
        ] do:[
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7937
            subm := aRecv aspectFor:sel.
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7938
            gotMenu := true.
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7939
        ].
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7940
        "/ used to be subm notNil; however, this is a bad test,
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7941
        "/ as it does not allow for the app to return nil for no-menu.
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7942
        gotMenu ifTrue:[^ subm].
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  7943
    ].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  7944
2043
133a9674bcdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  7945
    (Array with:(aRecv) with:(aRecv class))
133a9674bcdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  7946
    do:[:aPossibleReceiver |
4025
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7947
        MessageNotUnderstood handle:[:ex|
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7948
            ex message selector == sel ifFalse:[ ex reject ]
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7949
        ] do:[
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7950
            numArgs == 0 ifTrue:[
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7951
                subm := aPossibleReceiver perform:sel
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7952
            ] ifFalse:[
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7953
                numArgs == 1 ifTrue:[
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7954
                    subm := aPossibleReceiver perform:sel with:(menuItem argument ? menuPanel)
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7955
                ] ifFalse:[
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7956
                    subm := aPossibleReceiver perform:sel with:(menuItem argument) with:menuPanel
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7957
                ]
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7958
            ]
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7959
        ].
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7960
        subm notNil ifTrue:[^ subm].
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7961
        Smalltalk isSmalltalkDevelopmentSystem ifTrue:[
4027
Claus Gittinger <cg@exept.de>
parents: 4026
diff changeset
  7962
            "/ ('MenuPanel [info]: no submenu for "%1" from %2' bindWith:sel with:aPossibleReceiver) infoPrintCR.
4025
065f1854215f give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents: 3987
diff changeset
  7963
        ]
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  7964
    ].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  7965
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  7966
    ^ subm
2043
133a9674bcdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  7967
4027
Claus Gittinger <cg@exept.de>
parents: 4026
diff changeset
  7968
    "Modified: / 24-03-2011 / 11:20:24 / cg"
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  7969
!
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  7970
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7971
indicationValue
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7972
    "returns indication value or nil in case of no indication"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7973
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7974
    |numArgs sel recv|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7975
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7976
    indication isNil ifTrue:[^ nil].       "no indication specified"
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7977
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7978
    indication isSymbol ifFalse:[
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7979
        ^ indication value == true          "block or model"
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7980
    ].
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7981
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7982
    numArgs := indication numArgs.
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7983
    numArgs == 2 ifTrue:[
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7984
        recv := menuPanel receiver ? menuPanel application.
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7985
        (recv notNil and:[recv isValueModel not]) ifTrue:[
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7986
            sel := indication copyFrom:1 to:(indication indexOf:$:).
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7987
            sel := sel asSymbol.
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7988
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7989
            MessageNotUnderstood handle:[:ex|
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7990
                ex selector ~~ sel ifTrue:[
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7991
                    ex reject.
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7992
                ].
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7993
            ] do:[
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7994
                sel := recv perform:sel with:(menuItem argument).
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7995
            ]
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7996
        ].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7997
    ] ifFalse:[
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7998
        numArgs == 0 ifTrue:[
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7999
            sel := indication
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8000
        ] ifFalse:[
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8001
            sel := (indication copyWithoutLast:1) asSymbol.
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8002
        ].
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8003
        sel := self aspectAt:sel.
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8004
        sel isValueModel ifTrue:[
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8005
            indication := sel.
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8006
            indication addDependent:self.
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8007
        ].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8008
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8009
    ^ sel value == true
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8010
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8011
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8012
indicationValue:aValue
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8013
    "set the indication value"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8014
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8015
    |numArgs recv|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8016
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8017
    indication isNil ifTrue:[^ self].                                   "no indication specified"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8018
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8019
    indication isSymbol ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8020
	indication perform:#value: with:aValue ifNotUnderstood:nil.     "block or model"
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8021
	^ self
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8022
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8023
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8024
    (numArgs := indication numArgs) == 0 ifTrue:[                       "no arguments to selector; cannot set"
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8025
	^ self
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  8026
    ].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  8027
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  8028
    recv := menuPanel receiver.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8029
    recv isValueModel ifTrue:[^ self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8030
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  8031
    recv isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8032
	recv := menuPanel application.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8033
	recv isNil ifTrue:[^ self].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8034
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8035
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8036
    MessageNotUnderstood handle:[:ex|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8037
	(ex selector ~~ indication) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8038
	    ex reject
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8039
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8040
	self ifNotInUIBuilderInfoPrintCR:
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8041
	    ('MenuPanel::Item [info]: application (%1) does not respond to: %2'
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8042
	     bindWith:recv classNameWithArticle with:indication).
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8043
    ] do:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8044
	numArgs == 1 ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8045
	    recv perform:indication with:aValue
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8046
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8047
	    recv perform:indication with:(menuItem argument ? self) with:aValue
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8048
	]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8049
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8050
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8051
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8052
isEntered
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8053
    "returns true if the mouse pointer is over the item"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8054
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8055
    ^ menuPanel enteredItem == self
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8056
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8057
    "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
  8058
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8059
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  8060
separatorType
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8061
    "returns type of separator line or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8062
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  8063
    |c lbl|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8064
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8065
    self isSeparator ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8066
	^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8067
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8068
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  8069
    (lbl := label value) isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8070
	^ #singleLine
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8071
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8072
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  8073
    lbl size == 1 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8074
	c := lbl first.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8075
	c == $- ifTrue:[^ #singleLine].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8076
	c == $= ifTrue:[^ #doubleLine].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8077
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8078
    ^ #blankLine
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  8079
!
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  8080
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  8081
setupSubmenu
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8082
    |appl submenuProvider master recv submenuHolder newSubmenu submenuEncoding
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8083
     channel whoProvidedMenu t|
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8084
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8085
    channel := menuItem submenuChannel value.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8086
    channel isNil ifTrue:[ ^ subMenu ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8087
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8088
    subMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8089
	menuItem keepLinkedMenu ifTrue:[ ^ subMenu ].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8090
    ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8091
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8092
    channel isSymbol ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8093
	submenuHolder := channel
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8094
    ] ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8095
	"/ submenu is specified by a selector in submenuChannel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8096
	"/ who gets me the menu:
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8097
	"/ 1) submenuProvider (if not nil)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8098
	"/ 2) menuPanel application
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8099
	"/ 3) menuPanel receiver
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8100
	"/ 4) menuPanel application master-chain
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8101
	"/ 5) menuPanel receiver master-chain
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8102
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8103
	(submenuProvider := menuItem submenuProvider) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8104
	    submenuHolder := self findSubMenuIn:submenuProvider.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8105
	    whoProvidedMenu := submenuProvider.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8106
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8107
	submenuHolder isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8108
	    appl := menuPanel application.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8109
	    (appl notNil and:[appl ~~ submenuProvider]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8110
		submenuHolder := self findSubMenuIn:appl.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8111
		whoProvidedMenu := appl.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8112
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8113
	    submenuHolder isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8114
		recv := menuPanel receiver.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8115
		(recv notNil and:[recv ~~ appl and:[recv ~~ submenuProvider]]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8116
		    submenuHolder := self findSubMenuIn:recv.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8117
		    whoProvidedMenu := recv.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8118
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8119
		(submenuHolder isNil and:[appl notNil]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8120
		    t := appl.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8121
		    [ submenuHolder isNil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8122
		       and:[ (master := t perform:#masterApplication ifNotUnderstood:nil) notNil ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8123
		    ] whileTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8124
		       ( master ~~ appl
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8125
			and:[ master ~~ recv
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8126
			and:[ master ~~ submenuProvider ]] ) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8127
			    submenuHolder := self findSubMenuIn:master.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8128
			].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8129
			t := master.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8130
			whoProvidedMenu := master.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8131
		    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8132
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8133
		(submenuHolder isNil and:[recv notNil]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8134
		    t := recv.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8135
		    [ submenuHolder isNil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8136
		       and:[ (master := t perform:#masterApplication ifNotUnderstood:nil) notNil ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8137
		    ] whileTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8138
		       ( master ~~ appl
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8139
			and:[ master ~~ recv
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8140
			and:[ master ~~ submenuProvider ]] ) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8141
			    submenuHolder := self findSubMenuIn:master.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8142
			].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8143
			t := master.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8144
			whoProvidedMenu := master.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8145
		    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8146
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8147
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8148
	].
3935
852001cc6bd5 no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents: 3934
diff changeset
  8149
"/        submenuHolder isNil ifTrue:[
852001cc6bd5 no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents: 3934
diff changeset
  8150
"/            self halt:'did not find any menu'
852001cc6bd5 no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents: 3934
diff changeset
  8151
"/        ].
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8152
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8153
"/        appl := menuPanel application.
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8154
"/        appl isNil ifTrue:[
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8155
"/            appl := menuPanel receiver.
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8156
"/            appl notNil ifTrue:[
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8157
"/                (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8158
"/                    [submenuHolder isNil
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8159
"/                     and:[(master := appl perform:#masterApplication ifNotUnderstood:nil) notNil
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8160
"/                          and:[master ~~ appl]]] whileTrue:[
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8161
"/                        appl := master.
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8162
"/                        submenuHolder := self findSubMenuIn:appl.
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8163
"/                    ].
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8164
"/                ]
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8165
"/            ].
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8166
"/        ].
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8167
"/        submenuHolder isNil ifTrue:[
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8168
"/            (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8169
"/                (recv := menuPanel receiver) ~~ appl ifTrue:[
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8170
"/                    appl := recv.
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8171
"/                    submenuHolder := self findSubMenuIn:appl
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8172
"/                ]
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8173
"/            ]
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8174
"/        ]
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8175
    ].
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8176
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8177
    (newSubmenu := submenuHolder value) isArray ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8178
	submenuEncoding := newSubmenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8179
	newSubmenu := Menu decodeFromLiteralArray:submenuEncoding.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8180
	"/ cg: linked menus also may contain translations ...
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8181
	newSubmenu notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8182
	    whoProvidedMenu "appl" notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8183
		newSubmenu findGuiResourcesIn:whoProvidedMenu "appl".
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8184
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8185
	].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8186
    ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8187
    "/ appl notNil ifTrue:[submenu application:appl].
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8188
    self submenu:newSubmenu.
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  8189
    ^ subMenu
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  8190
3935
852001cc6bd5 no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents: 3934
diff changeset
  8191
    "Modified: / 22-09-2010 / 14:37:46 / cg"
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8192
!
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8193
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8194
spaceBetweenEmptyLines
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8195
	^ 3
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8196
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8197
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8198
!MenuPanel::Item methodsFor:'queries'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8199
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  8200
canChangeVisibility
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  8201
    "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
  8202
     otherwise there is a change notification raised if the model changed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8203
3122
81ab6b6b4ff2 *** empty log message ***
fm
parents: 3112
diff changeset
  8204
    ^ isVisible isSymbol or:[isVisible isValueModel]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  8205
"/  ^ isVisible notNil and:[isVisible ~~ true]
3112
01341303806d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
  8206
01341303806d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
  8207
    "Modified: / 11-10-2006 / 21:43:31 / cg"
3122
81ab6b6b4ff2 *** empty log message ***
fm
parents: 3112
diff changeset
  8208
    "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
  8209
!
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  8210
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8211
canSelect
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  8212
    "returns true if item is selectable; no separator, visible and enabled.
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8213
     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
  8214
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8215
    self isSeparator ifTrue:[^ false].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8216
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8217
    (self isVisible and:[self enabled]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8218
	(choice isNil or:[choice value ~= menuItem choiceValue]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8219
	    ^ true
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8220
	].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  8221
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  8222
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8223
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8224
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8225
containsPoint:aPoint
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8226
    "returns true if aPoint is contained in my layout"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8227
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8228
    (self isVisible and:[layout notNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8229
	^ layout containsPoint:aPoint
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8230
    ].
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8231
    ^ false
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8232
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8233
    "Created: / 13.11.2001 / 13:55:31 / cg"
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8234
!
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8235
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8236
containsPointX:x y:y
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8237
    "returns true if point is contained in my layout"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8238
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8239
    (self isVisible and:[layout notNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8240
	^ layout containsPointX:x y:y
505
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  8241
    ].
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  8242
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8243
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8244
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8245
hasDelayedMenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8246
    "returns true if a delayed menu exists"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8247
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  8248
    self hasSubmenu ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8249
	^ false
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8250
    ].
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  8251
    menuItem itemValue notNil ifTrue:[ ^ true ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  8252
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  8253
    (indication isNil and:[choice isNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8254
	^ false
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8255
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8256
    ^ true
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8257
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8258
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8259
hasDelayedMenuIndicator
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8260
    "returns true if the item has a delayed menu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8261
     and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8262
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8263
    menuPanel isPopUpView ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8264
	^ self hasDelayedMenu
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8265
    ].
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8266
    ^ false
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8267
!
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8268
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8269
hasIndication
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8270
    "returns true if on/off indication exists"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8271
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8272
    ^ indication notNil
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8273
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8274
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8275
hasMenuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8276
    "returns true if the item has a delayed menu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8277
     and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8278
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8279
    menuPanel isPopUpView ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8280
	^ self hasSubmenu and:[menuItem isButton]
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8281
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8282
    ^ false
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8283
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8284
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8285
hasSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8286
    "returns true if the item is configured as an subMenu entry"
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8287
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8288
    ^ subMenu notNil or:[ menuItem submenuChannel notNil ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8289
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8290
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8291
isEnabled
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8292
    "returns the enabled state"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8293
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8294
    ^ self enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8295
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8296
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  8297
isSeparator
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8298
    "returns true if item is a separator"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8299
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8300
    ^ displayLabel isNil
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  8301
!
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  8302
2159
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  8303
isToggle
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8304
    "returns true if on/off indication exists"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8305
2159
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  8306
    ^ self hasIndication and:[ self isButton ]
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  8307
!
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  8308
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8309
isVisible
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8310
    "returns the visibility state"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8311
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8312
    |state|
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8313
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8314
    isVisible isSymbol ifTrue:[
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8315
        state := self aspectAt:isVisible.
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8316
        state isValueModel ifTrue:[
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8317
            isVisible := state.
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8318
            isVisible addDependent:self.
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8319
        ].
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8320
    ] ifFalse:[
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8321
        state := isVisible
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8322
    ].
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8323
    ^ state value ~~ false
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  8324
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  8325
    "Modified: / 5.10.1998 / 12:08:28 / cg"
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8326
!
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8327
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8328
isVisible:something
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8329
    "change the visibility state; if the state changed, a redraw is performed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8330
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8331
    |oldState newState|
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8332
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8333
    isVisible isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8334
	oldState := true
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8335
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8336
	oldState := isVisible value.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8337
	isVisible isValueModel ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8338
	    isVisible removeDependent:self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8339
	]
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8340
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8341
    isVisible := something.
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8342
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8343
    isVisible isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8344
	newState := true
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8345
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8346
	isVisible isValueModel ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8347
	    isVisible addDependent:self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8348
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8349
	    isVisible isSymbol ifTrue:[^ self]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8350
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8351
	menuPanel shown ifFalse:[^ self].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8352
	newState := isVisible value.
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8353
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8354
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8355
    newState ~~ oldState ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8356
	menuPanel mustRearrange
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8357
    ]
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  8358
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  8359
    "Modified: / 5.10.1998 / 12:12:04 / cg"
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8360
!
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8361
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8362
menuIndicatorContains:aPoint
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8363
    "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
  8364
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8365
    |icon xSep|
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8366
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8367
    (self isVisible and:[layout notNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8368
	(layout containsPoint:aPoint) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8369
	    icon := self menuIndicatorIcon.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8370
	    icon notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8371
		xSep := layout right - icon width.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8372
		^ aPoint x >= xSep
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8373
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8374
	]
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8375
    ].
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8376
    ^ false
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8377
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8378
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8379
needsItemSpaceWhenDrawing
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8380
    ^ self isSeparator not and:[menuItem isButton not]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8381
!
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8382
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8383
shortcutKeyAsString
3601
e6e26baefa03 comment
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
  8384
    "converts shortcutKey to a text object for the menu-label-hint.
e6e26baefa03 comment
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
  8385
     returns nil, if the key has no assignment."
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8386
2972
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  8387
    |shortcutKey|
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8388
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8389
    shortcutKey := menuItem shortcutKey.
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  8390
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  8391
    shortcutKey isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8392
	^ nil
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  8393
    ].
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  8394
    shortcutKey isCharacter ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8395
	shortcutKey == Character space ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8396
	    ^ 'Space'
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8397
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8398
	^ shortcutKey asString
2972
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  8399
    ].
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  8400
    ^ menuPanel device shortKeyStringFor:shortcutKey.
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  8401
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  8402
    "Modified: / 08-08-2006 / 15:46:24 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8403
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8404
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8405
!MenuPanel::Item methodsFor:'selection'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8406
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8407
isSelected
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8408
    "returns true if item is selected"
1998
5059b7c9cd2c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1997
diff changeset
  8409
5059b7c9cd2c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1997
diff changeset
  8410
    ^ menuPanel notNil and:[menuPanel selection == self]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8411
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8412
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  8413
isSelected:isSelected
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  8414
    "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
  8415
     submenu and perform a redraw"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8416
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  8417
    (isSelected and:[menuPanel notNil]) ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8418
	self invalidate.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8419
	self hideSubmenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8420
	^ self
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  8421
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  8422
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8423
    menuPanel realized ifFalse:[ ^ self ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8424
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8425
    (indication isNil or:[menuItem isButton not]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8426
	self invalidate
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8427
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8428
    self hasSubmenu ifFalse:[ ^ self].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8429
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8430
    self hasDelayedMenu ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8431
	menuPanel openDelayed:self
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8432
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8433
	self setupSubmenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8434
	subMenu notNil ifTrue:[ self openSubmenu ].
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  8435
    ].
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  8436
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  8437
    "Modified: / 07-11-2006 / 11:08:03 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8438
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8439
2692
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  8440
!MenuPanel::Item::Adornment methodsFor:'accessing'!
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  8441
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  8442
argument2
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  8443
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  8444
  ^ argument2
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  8445
!
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  8446
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  8447
argument2:anArgumentOrNil
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  8448
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  8449
    argument2 := anArgumentOrNil
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  8450
! !
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  8451
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  8452
!MenuPanel::ScrollActivity class methodsFor:'default icons'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8453
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8454
icon
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8455
    "This resource specification was automatically generated
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8456
     by the ImageEditor of ST/X."
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8457
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8458
    "Do not manually edit this!! If it is corrupted,
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8459
     the ImageEditor may not be able to read the specification."
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8460
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8461
    "
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8462
     self icon inspect
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8463
     ImageEditor openOnClass:self andSelector:#icon
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8464
    "
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8465
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8466
    <resource: #image>
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8467
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8468
    ^Icon
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8469
	constantNamed:#'MenuPanel::ScrollActivity class icon'
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8470
	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
  8471
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8472
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  8473
!MenuPanel::ScrollActivity class methodsFor:'instance creation'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8474
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8475
new
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8476
    ^ self basicNew initialize
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8477
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8478
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  8479
!MenuPanel::ScrollActivity methodsFor:'accessing'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8480
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8481
activeMenu
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8482
    "returns the active menu the scrolling is activated on; nil
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8483
     is returned if scrolling is deactivated"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8484
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8485
    ^ activeMenu
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8486
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8487
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8488
direction
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8489
    "returns the scroll-direction"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8490
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8491
    ^ direction
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8492
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8493
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8494
iconAt:aDirection on:aMenu
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8495
    |icon device index|
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8496
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8497
    device := aMenu device.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8498
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8499
    aDirection == #PREV ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  8500
	aMenu verticalLayout ifTrue:[index := 3]    "/ 3 - 1 * 90  180
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8501
			    ifFalse:[index := 2]    "/ 2 - 1 * 90  90
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8502
    ] ifFalse:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  8503
	aMenu verticalLayout ifTrue:[index := 1]    "/ 1 - 1 * 90  0
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  8504
			    ifFalse:[index := 4]    "/ 4 - 1 * 90  270
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8505
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8506
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8507
    icon := icons at:index.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8508
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8509
    (icon isNil or:[icon device ~~ device]) ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  8510
	icon := self class icon.
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  8511
	index > 1 ifTrue:[ icon := icon rotated:(index - 1 * 90) ]
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  8512
		 ifFalse:[ icon := icon copy ].
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  8513
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  8514
	icon := icon onDevice:device.
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  8515
	icon clearMaskedPixels.
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  8516
	icons at:index put:icon
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8517
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8518
    ^ icon
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8519
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8520
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  8521
!MenuPanel::ScrollActivity methodsFor:'initialization'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8522
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8523
initialize
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8524
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8525
    semaLock := RecursionLock new.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8526
    icons    := Array new:4.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8527
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8528
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  8529
!MenuPanel::ScrollActivity methodsFor:'queries'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8530
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8531
isActive
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8532
    "returns true if scrolling is activated"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8533
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8534
    ^ activeMenu notNil
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8535
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8536
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  8537
!MenuPanel::ScrollActivity methodsFor:'user operations'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8538
3295
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8539
startIfRequiredAt:aDirection on:aMenu comesViaButtonPress:comesViaButtonPress
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8540
    "start scrolling; returns true if scrolling is activated"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8541
3295
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8542
    |bounds index isScrolledMenu boundsOnRoot|
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8543
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8544
    isScrolledMenu := (aDirection notNil and:[aMenu notNil and:[aMenu hasScrollers]]).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8545
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8546
    semaLock critical:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8547
	self stop.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8548
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8549
	isScrolledMenu ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8550
	    bounds := aMenu scrollerBoundsAt:aDirection.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8551
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8552
	    comesViaButtonPress ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8553
		boundsOnRoot := Rectangle origin:(aMenu device translatePointToRoot:(bounds origin) fromView:aMenu)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8554
					  extent:(bounds extent).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8555
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8556
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8557
	    activeMenu := aMenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8558
	    direction  := aDirection.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8559
	    index      := aMenu indexOfItemAtScroller:aDirection.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8560
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8561
	    index ~~ 0 ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8562
		scrollTask :=
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8563
		    [
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8564
			|item step continue|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8565
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8566
			[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8567
			    step := (aDirection == #PREV) ifTrue:[-1] ifFalse:[1].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8568
			    ( aMenu shown and:[(item := aMenu itemAt:index) notNil] ) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8569
				aMenu makeItemVisible:item.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8570
				index := index + step.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8571
			    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8572
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8573
			    Delay waitForSeconds:(ButtonController defaultInitialDelay).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8574
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8575
			    [
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8576
				continue := (aMenu shown and:[(item := aMenu itemAt:index) notNil]).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8577
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8578
				boundsOnRoot notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8579
				    continue ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8580
					continue := boundsOnRoot containsPoint:aMenu sensor mousePoint.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8581
				    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8582
					boundsOnRoot := nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8583
				    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8584
				].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8585
				continue
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8586
			    ]  whileTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8587
				aMenu makeItemVisible:item.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8588
				Delay waitForSeconds:(ButtonController defaultRepeatDelay).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8589
				index := index + step.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8590
			    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8591
			    item := nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8592
			] ensure:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8593
			    activeMenu := direction := scrollTask := nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8594
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8595
			    item notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8596
				"/ process was killed
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8597
				aMenu invalidate:bounds
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8598
			    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8599
			].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8600
			boundsOnRoot notNil ifTrue:[ aMenu invalidate:bounds ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8601
		    ] forkAt:8.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8602
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8603
	]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8604
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8605
    ^ bounds notNil
2047
62de65e3a61b initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents: 2046
diff changeset
  8606
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  8607
    "Created: ca"
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  8608
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  8609
    "Modified: / 13.11.2001 / 20:15:52 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8610
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8611
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8612
stop
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8613
    "stop scrolling; returns true if the scrolling was activated otherwise false"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8614
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8615
    |task resp|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8616
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8617
    activeMenu isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8618
	^ false
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8619
    ].
3295
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8620
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8621
    semaLock critical:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8622
	resp := activeMenu notNil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8623
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8624
	(task := scrollTask) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8625
	    scrollTask := nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8626
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8627
	    Error handle:[:ex|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8628
	    ] do:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8629
		task terminateWithAllSubprocessesInGroup.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8630
		task waitUntilTerminated.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8631
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8632
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8633
	activeMenu := direction := nil.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8634
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8635
    ^ resp
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8636
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8637
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8638
!MenuPanel class methodsFor:'documentation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8639
4109
ed4578d2f007 changed: #maxExtent
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
  8640
version
4167
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  8641
    ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.544 2013-01-17 10:45:14 cg Exp $'
4109
ed4578d2f007 changed: #maxExtent
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
  8642
!
ed4578d2f007 changed: #maxExtent
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
  8643
3780
14184c505e24 changed:
Claus Gittinger <cg@exept.de>
parents: 3754
diff changeset
  8644
version_CVS
4167
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  8645
    ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.544 2013-01-17 10:45:14 cg Exp $'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8646
! !
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8647
4167
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  8648
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8649
MenuPanel initialize!